Esempio n. 1
0
 def setUp(self):
     super(UnitTestsBase, self).setUp()
     Request.set_db_session(self.connection, self.Session)
     self.req = Request({})
     self.ctx = pyramid.testing.DummyResource
     self.configurator = pyramid.testing.setUp(request=self.req)
     self.req.registry = self.configurator.registry
     self.configurator.include("pyramid_mailer.testing")
Esempio n. 2
0
def main(global_config, **settings):
    engine = engine_from_config(settings, 'sqlalchemy.')
    # Set metadata for tables.
    Base.metadata.create_all(engine)
    # Set Engine in Request factory.
    # It is needed by Request objects to build Session.
    Request.set_db_engine(engine)

    config = Configurator(settings=settings, request_factory=Request)
    includeme(config)

    return config.make_wsgi_app()
Esempio n. 3
0
def main(global_config, **settings):

    engine = engine_from_config(settings, 'sqlalchemy.')
    # Set metadata for tables.
    Base.metadata.create_all(engine)
    # Set Engine in Request factory.
    # It is needed by Request objects to build Session.
    Request.set_db_engine(engine)

    session_factory = session_factory_from_settings(settings)
    auth_policy = AuthenticationPolicy()
    config = Configurator(settings=settings,
                          request_factory=Request,
                          session_factory=session_factory,
                          authentication_policy=auth_policy)

    config.include(includeme)

    # configure website
    config.include(aybu.website.includeme)

    # configure controlpanel
    return config.make_wsgi_app()