[config] fix the load_site_cubicweb() method for to 'new-style' cubes (closes #16059402)
authorDavid Douard <david.douard@logilab.fr>
Wed, 02 Nov 2016 15:59:39 +0100
changeset 11793 b455460630a0
parent 11792 f1911a4638af
child 11794 d8830e2bd2e0
[config] fix the load_site_cubicweb() method for to 'new-style' cubes (closes #16059402) We first try to load the site_cubicweb module from the cubicweb_<cube> package, and if it fails, revert back to old cube path.
cubicweb/cwconfig.py
--- a/cubicweb/cwconfig.py	Thu Oct 13 15:31:02 2016 +0200
+++ b/cubicweb/cwconfig.py	Wed Nov 02 15:59:39 2016 +0100
@@ -843,7 +843,13 @@
     def _load_site_cubicweb(self, cube):
         """Load site_cubicweb.py from `cube` (or apphome if cube is None)."""
         if cube is not None:
-            modname = 'cubes.%s.site_cubicweb' % cube
+            try:
+                modname = 'cubicweb_%s' % cube
+                __import__(modname)
+            except ImportError:
+                modname = 'cubes.%s' % cube
+                __import__(modname)
+            modname = modname + '.site_cubicweb'
             __import__(modname)
             return sys.modules[modname]
         else: