we need extrapath when trying to import site_cubicweb files
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 22 Jan 2010 10:07:29 +0100
changeset 4324 e817a54cdbc1
parent 4323 aae19998dd93
child 4325 16642cc7d497
we need extrapath when trying to import site_cubicweb files
cwconfig.py
--- a/cwconfig.py	Fri Jan 22 10:07:03 2010 +0100
+++ b/cwconfig.py	Fri Jan 22 10:07:29 2010 +0100
@@ -883,8 +883,12 @@
                     self.warning('site_erudi.py is deprecated, should be renamed to site_cubicweb.py')
 
     def _load_site_cubicweb(self, sitefile):
-        from logilab.common.modutils import load_module_from_file
-        module = load_module_from_file(sitefile)
+        # XXX extrapath argument to load_module_from_file only in lgc > 0.46
+        from logilab.common.modutils import load_module_from_modpath, modpath_from_file
+        def load_module_from_file(filepath, path=None, use_sys=1, extrapath=None):
+            return load_module_from_modpath(modpath_from_file(filepath, extrapath),
+                                            path, use_sys)
+        module = load_module_from_file(sitefile, extrapath=self.extrapath)
         self.info('%s loaded', sitefile)
         # cube specific options
         if getattr(module, 'options', None):