pyramid_cubicweb/__init__.py
changeset 11564 a6547ff97ce0
parent 11563 f9473eb6a8a9
child 11567 4f8aa5fcd5da
equal deleted inserted replaced
11563:f9473eb6a8a9 11564:a6547ff97ce0
    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