pyramid_cubicweb/__init__.py
changeset 11511 13e0f569684c
parent 11503 ddf61aa73384
child 11522 568204930c85
--- a/pyramid_cubicweb/__init__.py	Thu Sep 18 17:18:09 2014 +0200
+++ b/pyramid_cubicweb/__init__.py	Fri Sep 19 19:17:50 2014 +0200
@@ -1,4 +1,5 @@
 import os
+import wsgicors
 
 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
 from pyramid.config import Configurator
@@ -39,4 +40,13 @@
 
     cwconfig = cwcfg.config_for(instance_name, debugmode=debug)
     config = make_cubicweb_application(cwconfig)
-    return config.make_wsgi_app()
+    app = config.make_wsgi_app()
+    # This replaces completely web/cors.py, which is not used by
+    # pyramid_cubicweb anymore
+    app = wsgicors.CORS(
+        app,
+        origin=cwconfig['access-control-allow-origin'],
+        headers=cwconfig['access-control-allow-headers'],
+        methods=cwconfig['access-control-allow-methods'],
+        credentials='true')
+    return app