equal
deleted
inserted
replaced
|
1 from pyramid.config import Configurator |
|
2 |
|
3 |
|
4 def make_cubicweb_application(cwconfig): |
|
5 """ |
|
6 Create a pyramid-based CubicWeb instance from a cubicweb configuration. |
|
7 |
|
8 It is initialy meant to be used by the 'pyramid' command of cubicweb-ctl. |
|
9 """ |
|
10 settings = { |
|
11 'session.secret': '11', # XXX |
|
12 } |
|
13 if cwconfig.debugmode: |
|
14 settings.update({ |
|
15 'pyramid.debug_authorization': True, |
|
16 'pyramid.debug_notfound': True, |
|
17 'pyramid.debug_routematch': True, |
|
18 }) |
|
19 config = Configurator(settings=settings) |
|
20 if cwconfig.debugmode: |
|
21 config.include('pyramid_debugtoolbar') |
|
22 config.registry['cubicweb.config'] = cwconfig |
|
23 config.registry['cubicweb.repository'] = repo = cwconfig.repository() |
|
24 config.registry['cubicweb.registry'] = repo.vreg |
|
25 config.include('pyramid_cubicweb.defaults') |
|
26 config.include('pyramid_cubicweb.core') |
|
27 config.include('pyramid_cubicweb.bwcompat') |
|
28 return config |