[cwconfig] drop _cube_modname
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Wed, 27 Mar 2019 16:25:06 +0100
changeset 12544 56e1132f19c3
parent 12543 71aa20cb43f2
child 12545 be36811f0d08
[cwconfig] drop _cube_modname Since we drop support for legacy cubes, this is equivalent to _cube_pkgname()
cubicweb/cwconfig.py
--- a/cubicweb/cwconfig.py	Wed Mar 27 16:19:50 2019 +0100
+++ b/cubicweb/cwconfig.py	Wed Mar 27 16:25:06 2019 +0100
@@ -242,15 +242,6 @@
     return cube
 
 
-def _cube_modname(cube):
-    modname = _cube_pkgname(cube)
-    loader = pkgutil.find_loader(modname)
-    if loader:
-        return modname
-    else:
-        return 'cubes.' + cube
-
-
 def _expand_modname(modname, recursive=True):
     """expand modules names `modname` if exists by recursively walking
     submodules and subpackages and yield (submodname, filepath) including
@@ -766,7 +757,7 @@
             modnames.append(('cubicweb', 'cubicweb.schemas.' + name))
         for cube in reversed(self.cubes()):
             for modname, filepath in _expand_modname(
-                    '{0}.schema'.format(_cube_modname(cube)),
+                    '{0}.schema'.format(_cube_pkgname(cube)),
                     recursive=False):
                 modnames.append((cube, modname))
         if self.apphome:
@@ -1284,7 +1275,7 @@
 
     def appobjects_cube_modnames(self, cube):
         modnames = []
-        cube_modname = _cube_modname(cube)
+        cube_modname = _cube_pkgname(cube)
         cube_submodnames = self._sorted_appobjects(self.cube_appobject_path)
         for name in cube_submodnames:
             for modname, filepath in _expand_modname('.'.join([cube_modname, name])):