consider CW_MODE='system', the opposite of 'user' (eg use 'installed' mode while using the forest) stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 31 Aug 2009 16:48:14 +0200
branchstable
changeset 3059 1be8bf42bc5d
parent 3058 19180dc9d1b1
child 3062 a8e901fc4457
consider CW_MODE='system', the opposite of 'user' (eg use 'installed' mode while using the forest)
cwconfig.py
--- a/cwconfig.py	Mon Aug 31 14:27:28 2009 +0200
+++ b/cwconfig.py	Mon Aug 31 16:48:14 2009 +0200
@@ -134,6 +134,9 @@
     'float' : 'Float',
     }
 
+_forced_mode = os.environ.get('CW_MODE')
+assert _forced_mode in (None, 'system', 'user')
+
 class CubicWebNoAppConfiguration(ConfigurationMixIn):
     """base class for cubicweb configuration without a specific instance directory
     """
@@ -150,7 +153,7 @@
         CUBES_DIR = '%(APYCOT_ROOT)s/local/share/cubicweb/cubes/' % os.environ
         # create __init__ file
         file(join(CUBES_DIR, '__init__.py'), 'w').close()
-    elif exists(join(CW_SOFTWARE_ROOT, '.hg')) or os.environ.get('CW_MODE') == 'user':
+    elif (exists(join(CW_SOFTWARE_ROOT, '.hg')) and _forced_mode != 'system') or _forced_mode == 'user':
         mode = 'dev'
         CUBES_DIR = abspath(normpath(join(CW_SOFTWARE_ROOT, '../cubes')))
     else: