From ca14860632e76b844911c441549a5d7a08b0de5b Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 11 Jun 2011 11:51:19 -0700 Subject: [PATCH] Replace tornado.web._unicode with tornado.escape._unicode. Add a test case where this matters (when the argument is None) --- tornado/test/web_test.py | 16 ++++++++++++++++ tornado/web.py | 12 +----------- 2 files changed, 17 insertions(+), 11 deletions(-) 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()