pyramid_cubicweb/__init__.py
changeset 11522 568204930c85
parent 11511 13e0f569684c
child 11532 6a1d0aa3ac85
--- 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)