]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Move _UIModuleNamespace from the top of web.py to the UIModule implementation.
authorBen Darnell <ben@bendarnell.com>
Sun, 12 May 2013 16:37:11 +0000 (12:37 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 12 May 2013 16:37:11 +0000 (12:37 -0400)
tornado/web.py

index 6d1148d0ec1dcfe16a206207e7eddd7349776c06..52c9eb18a45027b06e77b4de183f75b626081a16 100644 (file)
@@ -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):