refactor to avoid having to define CW_INSTANCE_DATA when CW_REGISTRY is set
authorsylvain.thenault@logilab.fr
Thu, 26 Mar 2009 18:51:29 +0100
changeset 1170 a7c089405185
parent 1169 52058e8a3af9
child 1171 60efe4a18692
refactor to avoid having to define CW_INSTANCE_DATA when CW_REGISTRY is set
cwconfig.py
--- a/cwconfig.py	Thu Mar 26 18:21:22 2009 +0100
+++ b/cwconfig.py	Thu Mar 26 18:51:29 2009 +0100
@@ -501,17 +501,16 @@
 class CubicWebConfiguration(CubicWebNoAppConfiguration):
     """base class for cubicweb server and web configurations"""
     
+    INSTANCE_DATA_DIR = None
     if CubicWebNoAppConfiguration.mode == 'test':
         root = os.environ['APYCOT_ROOT']
         REGISTRY_DIR = '%s/etc/cubicweb.d/' % root
-        INSTANCE_DATA_DIR = REGISTRY_DIR
         RUNTIME_DIR = '/tmp/'
         MIGRATION_DIR = '%s/local/share/cubicweb/migration/' % root
         if not exists(REGISTRY_DIR):
             os.makedirs(REGISTRY_DIR)
     elif CubicWebNoAppConfiguration.mode == 'dev':
         REGISTRY_DIR = expanduser('~/etc/cubicweb.d/')
-        INSTANCE_DATA_DIR = REGISTRY_DIR
         RUNTIME_DIR = '/tmp/'
         MIGRATION_DIR = join(CW_SOFTWARE_ROOT, 'misc', 'migration')
     else: #mode = 'installed'
@@ -574,7 +573,8 @@
     @classmethod
     def instance_data_dir(cls):
         """return the instance data directory"""
-        return env_path('CW_INSTANCE_DATA', cls.INSTANCE_DATA_DIR,
+        return env_path('CW_INSTANCE_DATA',
+                        cls.INSTANCE_DATA_DIR or cls.REGISTRY_DIR,
                         'additional data')
         
     @classmethod