# HG changeset patch # User Sylvain Thénault # Date 1264151223 -3600 # Node ID aae19998dd930d90fca06e0ee6d7b1e6f17f388c # Parent f65743cc53e459c5f2af63cc5278b2e4a8eed3a4 move extra path computing as a configuration class property so we can reused it diff -r f65743cc53e4 -r aae19998dd93 cwconfig.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, diff -r f65743cc53e4 -r aae19998dd93 cwvreg.py --- 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: