예제 #1
0
def main(global_config, **settings):
    """
        Main function : returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    config = prepare_config(**settings)

    dbsession = initialize_sql(engine)

    config = base_configure(config, dbsession, **settings)
    config.configure_celery(global_config['__file__'])

    return config.make_wsgi_app()
예제 #2
0
def main(global_config, **settings):
    """
        Main function : returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    config = prepare_config(**settings)

    dbsession = initialize_sql(engine)

    config = base_configure(config, dbsession, **settings)
    config.configure_celery(global_config['__file__'])

    return config.make_wsgi_app()
예제 #3
0
def main(global_config, **settings):
    """
        Main function : returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    session_factory = get_session_factory(settings)
    set_cache_regions_from_settings(settings)
    auth_policy = SessionAuthenticationPolicy(callback=get_groups)
    acl_policy = ACLAuthorizationPolicy()

    config = Configurator(settings=settings,
                        authentication_policy=auth_policy,
                        authorization_policy=acl_policy,
                        session_factory=session_factory)
    config.begin()
    config.commit()

    dbsession = initialize_sql(engine)
    wrap_db_objects()
    BaseDBFactory.dbsession = dbsession

    # Application main configuration
    config._set_root_factory(RootFactory)
    config.set_default_permission('view')

    # Adding some usefull properties to the request object
    config.set_request_property(lambda _: dbsession(), 'dbsession', reify=True)
    config.set_request_property(get_avatar, 'user', reify=True)
    config.set_request_property(lambda _:get_config(), 'config')

    add_static_views(config, settings)

    for module in AUTONOMIE_MODULES:
        config.include(module)

    # Set deform multi renderer handling translation for both chameleon and
    # mako templates
    set_deform_renderer()
    # Set json renderer
    set_json_renderer(config)
    config.add_translation_dirs("colander:locale/", "deform:locale")
    add_resources_to_registry()

    return config.make_wsgi_app()
예제 #4
0
def main(global_config, **settings):
    """
        Main function : returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    config = prepare_config(**settings)

    dbsession = initialize_sql(engine)

    config = base_configure(config, dbsession, **settings)
    from autonomie.utils.filedepot import (
        configure_filedepot,
    )
    configure_filedepot(settings)
    config.configure_celery(global_config['__file__'])

    config.commit()
    # for i in config.introspector.get_category('permissions'):
    #     print(i['introspectable'].discriminator)

    return config.make_wsgi_app()
예제 #5
0
def main(global_config, **settings):
    """
        Main function : returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    config = prepare_config(**settings)

    dbsession = initialize_sql(engine)

    config = base_configure(config, dbsession, **settings)
    from autonomie.utils.filedepot import (
        configure_filedepot,
    )
    configure_filedepot(settings)
    config.configure_celery(global_config['__file__'])

    config.commit()
    # for i in config.introspector.get_category('permissions'):
    #     print(i['introspectable'].discriminator)

    return config.make_wsgi_app()