Browse Source

Ensure lazy-loading works with subpackages.

tags/v0.2
Ben Kurtovic 12 years ago
parent
commit
d0217d7b87
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      earwigbot/lazy.py

+ 2
- 0
earwigbot/lazy.py View File

@@ -60,6 +60,8 @@ class _LazyModule(type):
parents = (ModuleType,)
klass = type.__new__(cls, "module", parents, attributes)
sys.modules[name] = klass(name)
if "." in name: # Also ensure the parent exists
_LazyModule(name.rsplit(".", 1)[0])
return sys.modules[name]
finally:
release_lock()


Loading…
Cancel
Save