move extra path computing as a configuration class property so we can reused it
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 22 Jan 2010 10:07:03 +0100
changeset 4323 aae19998dd93
parent 4322 f65743cc53e4
child 4324 e817a54cdbc1
move extra path computing as a configuration class property so we can reused it
cwconfig.py
cwvreg.py
--- a/cwconfig.py	Fri Jan 22 08:49:16 2010 +0100
+++ b/cwconfig.py	Fri Jan 22 10:07:03 2010 +0100
@@ -84,7 +84,7 @@
 from os.path import exists, join, expanduser, abspath, normpath, basename, isdir
 from warnings import warn
 
-from logilab.common.decorators import cached
+from logilab.common.decorators import cached, classproperty
 from logilab.common.deprecation import deprecated
 from logilab.common.logging_ext import set_log_methods, init_log
 from logilab.common.configuration import (Configuration, Method,
@@ -356,6 +356,13 @@
             path.append(cls.CUBES_DIR)
         return path
 
+    @classproperty
+    def extrapath(cls):
+        extrapath = {}
+        for cubesdir in cls.cubes_search_path():
+            if cubesdir != cls.CUBES_DIR:
+                extrapath[cubesdir] = 'cubes'
+
     @classmethod
     def cube_dir(cls, cube):
         """return the cube directory for the given cube id,
--- a/cwvreg.py	Fri Jan 22 08:49:16 2010 +0100
+++ b/cwvreg.py	Fri Jan 22 10:07:03 2010 +0100
@@ -373,12 +373,8 @@
 
     def _register_objects(self, path, force_reload=None):
         """overriden to remove objects requiring a missing interface"""
-        extrapath = {}
-        for cubesdir in self.config.cubes_search_path():
-            if cubesdir != self.config.CUBES_DIR:
-                extrapath[cubesdir] = 'cubes'
         if super(CubicWebVRegistry, self).register_objects(path, force_reload,
-                                                          extrapath):
+                                                          self.config.extrapath):
             self.initialization_completed()
             # don't check rtags if we don't want to cleanup_interface_sobjects
             for rtag in RTAGS: