cubicweb/__init__.py
changeset 11473 f765b1b16a2c
parent 11457 d404fd8499dd
child 11767 432f87a63057
--- a/cubicweb/__init__.py	Tue Sep 13 10:16:00 2016 +0200
+++ b/cubicweb/__init__.py	Thu Sep 15 21:22:53 2016 +0200
@@ -24,6 +24,7 @@
 import logging
 import os
 import pickle
+import pkgutil
 import sys
 import warnings
 import zlib
@@ -304,18 +305,4 @@
             except ImportError:
                 return None
             else:
-                return _CubesLoader(modinfo)
-
-
-class _CubesLoader(object):
-    """Module loader handling redirection of import of "cubes.<name>"
-    to "cubicweb_<name>".
-    """
-
-    def __init__(self, modinfo):
-        self.modinfo = modinfo
-
-    def load_module(self, fullname):
-        if fullname not in sys.modules:  # Otherwise, it's a reload.
-            sys.modules[fullname] = imp.load_module(fullname, *self.modinfo)
-        return sys.modules[fullname]
+                return pkgutil.ImpLoader(fullname, *modinfo)