Example #1
0
def main(global_config, **settings):
    """ This function returns a WSGI application.
    	"""
    engine = engine_from_config(settings, 'sqlalchemy.')
    get_root = appmaker(engine)
    config = Configurator(settings=settings, root_factory=get_root)
    config.add_subscriber(add_renderer_globals, BeforeRender)
    config.add_static_view('static', 'whisperer:static')
    config.scan()
    return config.make_wsgi_app()
Example #2
0
def main(global_config, **settings):
    	""" This function returns a WSGI application.
    	"""
    	engine = engine_from_config(settings, 'sqlalchemy.')
    	get_root = appmaker(engine)
    	config = Configurator(settings=settings, root_factory=get_root)
    	config.add_subscriber(add_renderer_globals, BeforeRender)
    	config.add_static_view('static', 'whisperer:static')
    	config.scan()
	return config.make_wsgi_app()
Example #3
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    if asbool(settings.get('wingdbstub', 'false')):
        import wingdbstub

    # evolve ZODB database to latest version
    db = db_from_uri(settings['zodbconn.uri'])
    conn = db.open()
    evolve_database(appmaker(conn.root()), __sw_version__)
    db.close()

    # set up beaker session
    session_factory = session_factory_from_settings(settings)
    # set up beaker cache
    set_cache_regions_from_settings(settings)

    config = Configurator(root_factory=root_factory, settings=settings)

    config.include(set_auth_policies)

    config.include(add_user_property)

    # include pyramid plugins
    config.include('pyramid_beaker')
    config.include('pyramid_tm')
    config.include('pyramid_zodbconn')
    config.include('pyramid_rewrite')

    # register beaker session factory
    config.set_session_factory(session_factory)

    # This is only needed when using SQLAlchemy
    #engine = engine_from_config(settings, 'sqlalchemy.')
    #DBSession.configure(bind=engine)

    # add static views
    config.include(add_static_views)

    # scan for declarative configurations
    config.scan()

    # add url rewriting rules
    config.include(add_rewrite_rules)

    # return WSGI application instance
    return config.make_wsgi_app()
Example #4
0
 def _callFUT(self, zodb_root):
     from models import appmaker
     return appmaker(zodb_root)
Example #5
0
def root_factory(request):
    conn = get_connection(request)
    return appmaker(conn.root())