Example #1
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, "sqlalchemy.")
    initialize_sql(engine)
    config = Configurator(settings=settings)
    config.add_static_view("static", "fatest:static")
    config.add_route("home", "/", view="fatest.views.my_view", view_renderer="templates/mytemplate.pt")

    # configure the security stuff
    config = Configurator(
        settings=settings,
        authentication_policy=RemoteUserAuthenticationPolicy(),
        authorization_policy=ACLAuthorizationPolicy(),
    )

    # pyramid_formalchemy's configuration
    config.include("pyramid_formalchemy")
    config.include("fa.jquery")
    config.formalchemy_admin("admin", package="fatest", view="fa.jquery.pyramid.ModelView", factory=ModelsWithACL)

    return config.make_wsgi_app()
Example #2
0
def _initTestingDB():
    from sqlalchemy import create_engine
    from fatest.models import initialize_sql
    session = initialize_sql(create_engine('sqlite://'))
    return session