pyramid_cubicweb/__init__.py
changeset 11511 13e0f569684c
parent 11503 ddf61aa73384
child 11522 568204930c85
equal deleted inserted replaced
11510:2e52647af650 11511:13e0f569684c
     1 import os
     1 import os
       
     2 import wsgicors
     2 
     3 
     3 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
     4 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
     4 from pyramid.config import Configurator
     5 from pyramid.config import Configurator
     5 
     6 
     6 
     7 
    37     if debug is None:
    38     if debug is None:
    38         debug = 'CW_DEBUG' in os.environ
    39         debug = 'CW_DEBUG' in os.environ
    39 
    40 
    40     cwconfig = cwcfg.config_for(instance_name, debugmode=debug)
    41     cwconfig = cwcfg.config_for(instance_name, debugmode=debug)
    41     config = make_cubicweb_application(cwconfig)
    42     config = make_cubicweb_application(cwconfig)
    42     return config.make_wsgi_app()
    43     app = config.make_wsgi_app()
       
    44     # This replaces completely web/cors.py, which is not used by
       
    45     # pyramid_cubicweb anymore
       
    46     app = wsgicors.CORS(
       
    47         app,
       
    48         origin=cwconfig['access-control-allow-origin'],
       
    49         headers=cwconfig['access-control-allow-headers'],
       
    50         methods=cwconfig['access-control-allow-methods'],
       
    51         credentials='true')
       
    52     return app