From: Ben Darnell Date: Sun, 12 May 2013 16:37:11 +0000 (-0400) Subject: Move _UIModuleNamespace from the top of web.py to the UIModule implementation. X-Git-Tag: v3.1.0~76^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f98cfd2ecea7aed0be66a1638c64653ee220c39;p=thirdparty%2Ftornado.git Move _UIModuleNamespace from the top of web.py to the UIModule implementation. --- diff --git a/tornado/web.py b/tornado/web.py index 6d1148d0e..52c9eb18a 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -104,22 +104,6 @@ except ImportError: from urllib.parse import urlencode # py3 -class _UIModuleNamespace(object): - """Lazy namespace which creates UIModule proxies bound to a handler.""" - def __init__(self, handler, ui_modules): - self.handler = handler - self.ui_modules = ui_modules - - def __getitem__(self, key): - return self.handler._ui_module(key, self.ui_modules[key]) - - def __getattr__(self, key): - try: - return self[key] - except KeyError as e: - raise AttributeError(str(e)) - - class RequestHandler(object): """Subclass this class and define `get()` or `post()` to make a handler. @@ -1637,7 +1621,7 @@ class StaticFileHandler(RequestHandler): local root directory of the content to be served. Note that a capture group in the regex is required to parse the value for - the ``path`` argument to the get() method (different than the constructor + the ``path`` argument to the get() method (different than the constructor argument above); see `URLSpec` for details. To support aggressive browser caching, if the argument ``v`` is given @@ -2064,6 +2048,22 @@ class TemplateModule(UIModule): return "".join(self._get_resources("html_body")) +class _UIModuleNamespace(object): + """Lazy namespace which creates UIModule proxies bound to a handler.""" + def __init__(self, handler, ui_modules): + self.handler = handler + self.ui_modules = ui_modules + + def __getitem__(self, key): + return self.handler._ui_module(key, self.ui_modules[key]) + + def __getattr__(self, key): + try: + return self[key] + except KeyError as e: + raise AttributeError(str(e)) + + class URLSpec(object): """Specifies mappings between URLs and handlers.""" def __init__(self, pattern, handler_class, kwargs=None, name=None):