# HG changeset patch # User Denis Laxalde # Date 1518683748 -3600 # Node ID 043db1f91922bdd57607ef6183702e596bdf5a44 # Parent 3f57a23e995426fedebab884e9bfc1d46756f33c [cwconfig] Get rid of _forced_mode global And compute CubicWebNoAppConfiguration.mode within the class namespace. Related to #17132990. diff -r 3f57a23e9954 -r 043db1f91922 cubicweb/cwconfig.py --- a/cubicweb/cwconfig.py Thu Feb 15 09:27:15 2018 +0100 +++ b/cubicweb/cwconfig.py Thu Feb 15 09:35:48 2018 +0100 @@ -391,8 +391,6 @@ 'float' : 'Float', } -_forced_mode = os.environ.get('CW_MODE') -assert _forced_mode in (None, 'system', 'user') try: _INSTALL_PREFIX = os.environ['CW_INSTALL_PREFIX'] @@ -415,11 +413,12 @@ quick_start = False if 'VIRTUAL_ENV' in os.environ: - mode = _forced_mode or 'user' + mode = os.environ.get('CW_MODE', 'user') _CUBES_DIR = join(_INSTALL_PREFIX, 'share', 'cubicweb', 'cubes') else: - mode = _forced_mode or 'system' + mode = os.environ.get('CW_MODE', 'system') _CUBES_DIR = join(_INSTALL_PREFIX, 'share', 'cubicweb', 'cubes') + assert mode in ('system', 'user'), '"CW_MODE" should be either "user" or "system"' CUBES_DIR = realpath(abspath(os.environ.get('CW_CUBES_DIR', _CUBES_DIR))) CUBES_PATH = os.environ.get('CW_CUBES_PATH', '').split(os.pathsep)