wsgi: clearer exception when CW_INSTANCE is missing
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Thu, 16 Jun 2016 16:25:32 +0200
changeset 11623 b6f6737d4823
parent 11622 308ac9def79f
child 11624 e74bd3130d99
wsgi: clearer exception when CW_INSTANCE is missing instance_name is mandatory for cwcfg.config_for() Raise with a KeyError: 'CW_INSTANCE' instead of hard to read exception.
pyramid_cubicweb/__init__.py
--- a/pyramid_cubicweb/__init__.py	Fri Jun 03 17:58:43 2016 +0200
+++ b/pyramid_cubicweb/__init__.py	Thu Jun 16 16:25:32 2016 +0200
@@ -136,7 +136,7 @@
 
     """
     if instance_name is None:
-        instance_name = os.environ.get('CW_INSTANCE')
+        instance_name = os.environ['CW_INSTANCE']
     if debug is None:
         debug = 'CW_DEBUG' in os.environ