]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Used tornado.util.import_object 294/head
authorDavid Wilemski <david@davidwilemski.com>
Sat, 2 Jul 2011 22:22:51 +0000 (18:22 -0400)
committerDavid Wilemski <david@davidwilemski.com>
Sat, 2 Jul 2011 22:22:51 +0000 (18:22 -0400)
tornado/web.py

index ffcbfd1d08d6100bbcf9c672aa372b384045a975..a47c2943fc0c2e78878dee0c8ff704e0df9506ed 100644 (file)
@@ -80,7 +80,7 @@ from tornado import locale
 from tornado import stack_context
 from tornado import template
 from tornado.escape import utf8, _unicode
-from tornado.util import b, bytes_type
+from tornado.util import b, bytes_type, import_object
 
 try:
     from io import BytesIO  # python 3
@@ -1175,14 +1175,9 @@ class Application(object):
                 handler = spec[1]
 
                 if isinstance(handler, str):
-                    # Lazy load the Module and instantiate the class
+                    # import the Module and instantiate the class
                     # Must be a fully qualified name (module.ClassName)
-                    parts = handler.split('.')
-                    handler = ".".join(parts[:-1]) # create module name 
-                    handler = __import__(handler) # import the module
-                    for part in parts[1:]:
-                        handler = getattr(handler, part)
-                    # The class has now been loaded and we can continue
+                    handler = import_object(handler)
 
                 if len(spec) == 3:
                     kwargs = spec[2]