[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.
--- 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: