Commits

Jason R. Coombs committed 701f413

Simplified modules(). It's safe and efficient to call __import__ every time, and much cleaner.

Comments (0)

Files changed (1)

cherrypy/lib/reprconf.py

 
 def modules(modulePath):
     """Load a module and retrieve a reference to that module."""
-    try:
-        mod = sys.modules[modulePath]
-        if mod is None:
-            raise KeyError()
-    except KeyError:
-        __import__(modulePath)
-        mod = sys.modules[modulePath]
-    return mod
+    __import__(modulePath)
+    return sys.modules[modulePath]
 
 def attributes(full_attribute_name):
     """Load a module and retrieve an attribute of that module."""