コード例 #1
0
ファイル: environment.py プロジェクト: NERC-CEH/ecomaps
def load_environment(global_conf, app_conf):
    """Configure the Pylons environment via the ``pylons.config``
    object
    """
    config = PylonsConfig()

    # Pylons paths
    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    paths = dict(root=root,
                 controllers=os.path.join(root, 'controllers'),
                 static_files=os.path.join(root, 'public'),
                 templates=[os.path.join(root, 'templates')])

    # Initialize config with the basic options
    config.init_app(global_conf, app_conf, package='ecomaps', paths=paths)

    config['routes.map'] = make_map(config)
    config['pylons.app_globals'] = app_globals.Globals(config)
    config['pylons.h'] = ecomaps.lib.helpers

    config['pylons.app_globals'].genshi_loader = TemplateLoader(
        paths['templates'], auto_reload=True)

    # CONFIGURATION OPTIONS HERE (note: all config options will override
    # any Pylons config options)
    config['pylons.strict_tmpl_context'] = False

    # Setting up SQLAlchemy here
    initialise_session(config)

    # Hackery alert - the htmlfill function of formencode
    # fails when parsing html markup inside a CDATA section
    # which is bad for any JS that adds elements for example
    # Found a workaround here:
    # http://osdir.com/ml/python.formencode/2006-10/msg00019.html
    #
    FillingParser.CDATA_CONTENT_ELEMENTS = ()

    return config
コード例 #2
0
ファイル: integration_test.py プロジェクト: NERC-CEH/ecomaps
    def __init__(self, *args, **kwargs):

        super(IntegrationTests, self).__init__(*args, **kwargs)
        initialise_session(None, manual_connection_string=self._connectionstring)
        Base.metadata.drop_all(bind=Session.bind)
        Base.metadata.create_all(bind=Session.bind)
コード例 #3
0
ファイル: orm_tests.py プロジェクト: NERC-CEH/ecomaps
    def __init__(self, *args, **kwargs):

        super(ORMTests,self).__init__(*args, **kwargs)
        initialise_session(None, manual_connection_string=self._connectionstring)