Provides a full wsgi cubicweb application builder
authorChristophe de Vienne <christophe@unlish.com>
Thu, 06 Nov 2014 22:08:57 +0100
changeset 11522 568204930c85
parent 11521 bf813ae7bf9d
child 11523 8c80344b119e
Provides a full wsgi cubicweb application builder
pyramid_cubicweb/__init__.py
--- a/pyramid_cubicweb/__init__.py	Sun Nov 02 23:36:22 2014 +0100
+++ b/pyramid_cubicweb/__init__.py	Thu Nov 06 22:08:57 2014 +0100
@@ -32,13 +32,7 @@
     return config
 
 
-def wsgi_application(instance_name=None, debug=None):
-    if instance_name is None:
-        instance_name = os.environ.get('CW_INSTANCE')
-    if debug is None:
-        debug = 'CW_DEBUG' in os.environ
-
-    cwconfig = cwcfg.config_for(instance_name, debugmode=debug)
+def wsgi_application_from_cwconfig(cwconfig):
     config = make_cubicweb_application(cwconfig)
     app = config.make_wsgi_app()
     # This replaces completely web/cors.py, which is not used by
@@ -50,3 +44,14 @@
         methods=cwconfig['access-control-allow-methods'],
         credentials='true')
     return app
+
+
+def wsgi_application(instance_name=None, debug=None):
+    if instance_name is None:
+        instance_name = os.environ.get('CW_INSTANCE')
+    if debug is None:
+        debug = 'CW_DEBUG' in os.environ
+
+    cwconfig = cwcfg.config_for(instance_name, debugmode=debug)
+
+    return wsgi_application_from_cwconfig(cwconfig)