[config] Ignore cubicweb-pyramid in available_cubes()
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 11 Oct 2016 14:48:27 +0200
changeset 11711 fe0fcb9e1fd0
parent 11710 dd5df5fe7137
child 11712 c9129aae884b
[config] Ignore cubicweb-pyramid in available_cubes() So that, in particular, its ccplugin.py does not get loaded (which would hide the "pyramid" command in cubicweb). Related to #14023058.
cubicweb/cwconfig.py
--- a/cubicweb/cwconfig.py	Thu Oct 06 12:15:43 2016 +0200
+++ b/cubicweb/cwconfig.py	Tue Oct 11 14:48:27 2016 +0200
@@ -486,6 +486,9 @@
                     continue
                 if not re.match('[_A-Za-z][_A-Za-z0-9]*$', cube):
                     continue # skip invalid python package name
+                if cube == 'pyramid':
+                    cls._warn_pyramid_cube()
+                    continue
                 cubedir = join(directory, cube)
                 if isdir(cubedir) and exists(join(cubedir, '__init__.py')):
                     cubes.add(cube)
@@ -880,11 +883,15 @@
 
     _cubes = None
 
+    @classmethod
+    def _warn_pyramid_cube(cls):
+        cls.warning("cubicweb-pyramid got integrated into CubicWeb; "
+                    "remove it from your project's dependencies")
+
     def init_cubes(self, cubes):
         cubes = list(cubes)
         if 'pyramid' in cubes:
-            self.warning("cubicweb-pyramid got integrated into CubicWeb; "
-                         "remove it from your project's dependencies")
+            self._warn_pyramid_cube()
             cubes.remove('pyramid')
         self._cubes = self.reorder_cubes(cubes)
         # load cubes'__init__.py file first