Beispiel #1
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, "sqlalchemy.")
    settings["db.sessionmaker"] = DBSession
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)
    initialize_sql(engine, [populate, populate_wiki, populate_feeds])
    session_factory = session_factory_from_settings(settings)
    root_factory = "trumpet.resources.RootGroupFactory"
    request_factory = "trumpet.request.AlchemyRequest"
    config = Configurator(
        settings=settings,
        root_factory=root_factory,
        request_factory=request_factory,
        authentication_policy=authn_policy,
        authorization_policy=authz_policy,
        session_factory=session_factory,
    )
    configure_static(config)

    # config.include('pyramid_fanstatic')
    configure_base_layout(config)

    config.add_static_view("static", "static", cache_max_age=3600)
    config.add_route("home", "/")
    config.add_view("plum.views.MainViewer", route_name="home", renderer=basetemplate, layout="base")

    configure_login(config)
    configure_rssviewer(config, "/rssviewer")
    configure_wiki(config, "/wiki")

    return config.make_wsgi_app()
Beispiel #2
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    settings['db.sessionmaker'] = DBSession
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    Base.metadata.create_all(engine)
    initialize_sql(engine, [populate,
                            populate_sitetext,
                            populate_wiki,
                            populate_feeds,
                            populate_ticket_status])
    root_factory = 'trumpet.resources.RootGroupFactory'
    request_factory = 'trumpet.request.AlchemyRequest'
    session_factory = session_factory_from_settings(settings)
    config = Configurator(settings=settings,
                          root_factory=root_factory,
                          request_factory=request_factory,
                          authentication_policy=authn_policy,
                          authorization_policy=authz_policy)
    config.set_session_factory(session_factory)

    configure_static(config)
    configure_base_layout(config)
    
    config.add_static_view('static', 'kermas:static', cache_max_age=3600)

    config.add_route('home', '/')
    add_view(config, 'kermas.views.main.MainViewer', 'home')

    config.add_route('status', '/status/{context}')
    add_view(config, 'kermas.views.eddie.status.StatusViewer', 'status')

    config.add_route('portacopy', '/portacopy/{context}/{id}')
    config.add_view('kermas.views.portacopy.PortaCopyViewer',
                    route_name='portacopy',
                    renderer=basetemplate,
                    layout='base',
                    permission='admin')

    
    configure_login(config)
    configure_admin(config)
    configure_sitecontent(config)

    configure_wiki(config, '/wiki')
    configure_rssviewer(config, '/rssviewer')
    configure_consultant(config)
    
    
    #config.scan()
    return config.make_wsgi_app()
Beispiel #3
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    settings['db.sessionmaker'] = DBSession
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    if True:
        import transaction
        Base.metadata.create_all(engine)
        with transaction.manager:
            model = MyModel(name='one', value=1)
            DBSession.add(model)
            initialize_sql(engine, [populate,
                                    populate_wiki,
                                    populate_feeds])
    session_factory = session_factory_from_settings(settings)
    root_factory = 'trumpet.resources.RootGroupFactory'
    request_factory = 'trumpet.request.AlchemyRequest'
    config = Configurator(settings=settings,
                          root_factory=root_factory,
                          request_factory=request_factory,
                          authentication_policy=authn_policy,
                          authorization_policy=authz_policy,
                          session_factory=session_factory)
    configure_static(config)
                          
    #config.include('pyramid_fanstatic')
    configure_base_layout(config)

    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('home', '/')
    config.add_view('phoebe.views.MainViewer', route_name='home',
                    renderer=basetemplate,
                    layout='base')
    
    configure_login(config)

    #configure_rssviewer(config, '/rssviewer')
    config.add_route('rssviewer', '/rssviewer/{context}/{feed}')
    config.add_view('trumpet.views.rssviewer.MainViewer',
                    route_name='rssviewer', layout='base')

    configure_wiki(config, '/wiki')

    return config.make_wsgi_app()