1. cherrypy
  2. CherryPy


Jason R. Coombs  committed 701f413

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

  • Participants
  • Parent commits 88b20f2
  • Branches default

Comments (0)

Files changed (1)

File cherrypy/lib/reprconf.py

View file
  • Ignore whitespace
 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."""