cwconfig.py
branchstable
changeset 7005 f45f42256905
parent 6846 4dd1df437e15
child 7031 a04621040cad
--- a/cwconfig.py	Thu Feb 17 16:08:19 2011 +0100
+++ b/cwconfig.py	Thu Feb 17 16:08:20 2011 +0100
@@ -587,6 +587,14 @@
             return # cubes dir doesn't exists
 
     @classmethod
+    def load_available_configs(cls):
+        from logilab.common.modutils import load_module_from_file
+        for conffile in ('web/webconfig.py',  'etwist/twconfig.py',
+                        'server/serverconfig.py',):
+            if exists(join(CW_SOFTWARE_ROOT, conffile)):
+                load_module_from_file(join(CW_SOFTWARE_ROOT, conffile))
+
+    @classmethod
     def load_cwctl_plugins(cls):
         from logilab.common.modutils import load_module_from_file
         cls.cls_adjust_sys_path()
@@ -597,8 +605,8 @@
                 try:
                     load_module_from_file(join(CW_SOFTWARE_ROOT, ctlfile))
                 except ImportError, err:
-                    cls.info('could not import the command provider %s (cause : %s)' %
-                                (ctlfile, err))
+                    cls.error('could not import the command provider %s: %s',
+                              ctlfile, err)
                 cls.info('loaded cubicweb-ctl plugin %s', ctlfile)
         for cube in cls.available_cubes():
             oldpluginfile = join(cls.cube_dir(cube), 'ecplugin.py')
@@ -895,6 +903,7 @@
     def config_for(cls, appid, config=None, debugmode=False):
         """return a configuration instance for the given instance identifier
         """
+        cls.load_available_configs()
         config = config or guess_configuration(cls.instance_home(appid))
         configcls = configuration_cls(config)
         return configcls(appid, debugmode)