From: Ben Darnell Date: Sat, 11 Jun 2011 18:51:19 +0000 (-0700) Subject: Replace tornado.web._unicode with tornado.escape._unicode. X-Git-Tag: v2.0.0~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca14860632e76b844911c441549a5d7a08b0de5b;p=thirdparty%2Ftornado.git Replace tornado.web._unicode with tornado.escape._unicode. Add a test case where this matters (when the argument is None) --- diff --git a/tornado/test/web_test.py b/tornado/test/web_test.py index 39f5acb9a..f02d31f2c 100644 --- a/tornado/test/web_test.py +++ b/tornado/test/web_test.py @@ -244,6 +244,10 @@ class UIModuleResourceHandler(RequestHandler): def get(self): self.render("page.html", entries=[1,2]) +class OptionalPathHandler(RequestHandler): + def get(self, path): + self.write({"path": path}) + class WebTest(AsyncHTTPTestCase, LogTrapTestCase): def get_app(self): loader = DictLoader({ @@ -264,11 +268,17 @@ class WebTest(AsyncHTTPTestCase, LogTrapTestCase): url("/decode_arg_kw/(?P.*)", DecodeArgHandler), url("/linkify", LinkifyHandler), url("/uimodule_resources", UIModuleResourceHandler), + url("/optional_path/(.+)?", OptionalPathHandler), ] return Application(urls, template_loader=loader, autoescape="xhtml_escape") + def fetch_json(self, *args, **kwargs): + response = self.fetch(*args, **kwargs) + response.rethrow() + return json_decode(response.body) + def test_types(self): response = self.fetch("/typecheck/asdf?foo=bar", headers={"Cookie": "cook=ie"}) @@ -329,3 +339,9 @@ js_embed()