equal
deleted
inserted
replaced
10 from configparser import SafeConfigParser |
10 from configparser import SafeConfigParser |
11 except ImportError: |
11 except ImportError: |
12 from ConfigParser import SafeConfigParser |
12 from ConfigParser import SafeConfigParser |
13 |
13 |
14 |
14 |
15 def make_cubicweb_application(cwconfig): |
15 def make_cubicweb_application(cwconfig, settings=None): |
16 """ |
16 """ |
17 Create a pyramid-based CubicWeb instance from a cubicweb configuration. |
17 Create a pyramid-based CubicWeb instance from a cubicweb configuration. |
18 |
18 |
19 It is initialy meant to be used by the 'pyramid' command of cubicweb-ctl. |
19 It is initialy meant to be used by the 'pyramid' command of cubicweb-ctl. |
20 |
20 |
21 :param cwconfig: A CubicWeb configuration |
21 :param cwconfig: A CubicWeb configuration |
22 :returns: A Pyramid config object |
22 :returns: A Pyramid config object |
23 """ |
23 """ |
24 settings_filenames = [os.path.join(cwconfig.apphome, 'pyramid.ini')] |
24 settings_filenames = [os.path.join(cwconfig.apphome, 'pyramid.ini')] |
25 |
25 |
26 settings = {} |
26 settings = dict(settings) if settings else {} |
27 |
27 |
28 if cwconfig.debugmode: |
28 if cwconfig.debugmode: |
29 settings_filenames.insert( |
29 settings_filenames.insert( |
30 0, os.path.join(cwconfig.apphome, 'pyramid-debug.ini')) |
30 0, os.path.join(cwconfig.apphome, 'pyramid-debug.ini')) |
31 |
31 |