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()
def configure_wiki(config, rootpath): wiki_view = 'paellera.views.wiki.WikiViewer' config.add_route('view_wiki', rootpath) add_view(config, wiki_view, 'view_wiki') config.add_route('list_pages', '%s/listpages' % rootpath) add_view(config, wiki_view, 'list_pages') config.add_route('view_page', '%s/{pagename}' % rootpath) add_view(config, wiki_view, 'view_page') config.add_route('add_page', '%s/add_page/{pagename}' % rootpath) add_view(config, wiki_view, 'add_page', permission='wiki_add') config.add_route('edit_page', '%s/{pagename}/edit_page' % rootpath) add_view(config, wiki_view, 'edit_page', permission='wiki_edit')
def configure_wiki(config, rootpath): wiki_view = 'vignewton.views.wiki.WikiViewer' config.add_route('view_wiki', rootpath) add_view(config, wiki_view, 'view_wiki') config.add_route('list_pages', '%s/listpages' % rootpath) add_view(config, wiki_view, 'list_pages') config.add_route('view_page', '%s/{pagename}' % rootpath) add_view(config, wiki_view, 'view_page') config.add_route('add_page', '%s/add_page/{pagename}' % rootpath) add_view(config, wiki_view, 'add_page', permission='wiki_add') config.add_route('edit_page', '%s/{pagename}/edit_page' % rootpath) add_view(config, wiki_view, 'edit_page', permission='wiki_edit')
def configure_admin(config, rootpath='/admin', permission='admin'): config.add_route('admin', rootpath) add_view(config, main_view, 'admin', permission=permission) config.add_route('admin_images', '%s/images/{context}/{id}' % rootpath) add_view(config, 'paellera.views.admin.images.ImageManagementViewer', 'admin_images', permission=permission) config.add_route('admin_sitetext', '%s/sitetext/{context}/{id}' % rootpath) add_view(config, 'paellera.views.admin.sitetext.SiteTextViewer', 'admin_sitetext', permission=permission) config.add_route('admin_users', '%s/users/{context}/{id}' % rootpath) add_view(config, 'paellera.views.admin.users.UserManagementViewer', 'admin_users', permission=permission)
def configure_admin(config, rootpath='/admin', permission='admin'): config.add_route('admin', rootpath) add_view(config, main_view, 'admin', permission=permission) config.add_route('admin_images', '%s/images/{context}/{id}' % rootpath) add_view(config, 'vignewton.views.admin.images.ImageManagementViewer', 'admin_images', permission=permission) config.add_route('admin_sitetext', '%s/sitetext/{context}/{id}' % rootpath) add_view(config, 'vignewton.views.admin.sitetext.SiteTextViewer', 'admin_sitetext', permission=permission) config.add_route('admin_users', '%s/users/{context}/{id}' % rootpath) add_view(config, 'vignewton.views.admin.users.UserManagementViewer', 'admin_users', permission=permission) config.add_route('admin_credits', '%s/credits/{context}/{id}' % rootpath) add_view(config, 'vignewton.views.admin.credits.CreditsViewer', 'admin_credits', permission=permission) config.add_route('admin_bets', '%s/bets/{context}/{id}' % rootpath) add_view(config, 'vignewton.views.admin.bets.BetsViewer', 'admin_bets', permission=permission) config.add_route('admin_updatedb', '%s/updatedb/{context}/{id}' % rootpath) add_view(config, 'vignewton.views.admin.updatedb.UpdateDBViewer', 'admin_updatedb', permission=permission)
def configure_adminNew(config, rootpath='/admin', permission='admin'): config.add_route('admin', '%s/*traverse' % rootpath, factory='mslemon.views.admin.main.admin_root_factory') add_view(config, main_view, 'admin', permission=permission)
def configure_adminOrig(config, rootpath='/admin', permission='admin'): config.add_route('admin', rootpath) add_view(config, main_view, 'admin', permission=permission) config.add_route('admin_images', '%s/images/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.images.ImageManagementViewer', 'admin_images', permission=permission) config.add_route('admin_sitetext', '%s/sitetext/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.sitetext.SiteTextViewer', 'admin_sitetext', permission=permission) config.add_route('admin_users', '%s/users/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.users.UserManagementViewer', 'admin_users', permission=permission) config.add_route('admin_users_bb', '%s/usersbb' % rootpath) add_view(config, 'mslemon.views.admin.usersbb.AppViewer', 'admin_users_bb', permission=permission) route_name = 'admin_dbadmin' config.add_route(route_name, '%s/dbadmin/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.dbadmin.DBAdminViewer', route_name, permission=permission) route = 'admin_site_templates' config.add_route(route, '%s/sitetemplates/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.templatemgr.MainViewer', route, permission=permission) route = 'admin_sitecontent_mgr' config.add_route(route, '%s/sitecontentmgr/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.contentmgr.MainViewer', route, permission=permission) route = 'admin_sitecontent_mgr_bb' config.add_route(route, '%s/sitecontentmgrbb/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.contentmgrbb.AppViewer', route, permission=permission) route = 'admin_webviews' config.add_route(route, '%s/webviewmgr/{context}/{id}' % rootpath) add_view(config, 'mslemon.views.admin.webviewmgr.MainViewer', route, permission=permission)
def configure_admin(config, rootpath='/admin', permission='admin'): config.add_route('admin', rootpath) add_view(config, main_view, 'admin', permission=permission) config.add_route('admin_images', '%s/images/{context}/{id}' % rootpath) add_view(config, 'leaflet.views.admin.images.ImageManagementViewer', 'admin_images', permission=permission) config.add_route('admin_sitetext', '%s/sitetext/{context}/{id}' % rootpath) add_view(config, 'leaflet.views.admin.sitetext.SiteTextViewer', 'admin_sitetext', permission=permission) config.add_route('admin_users', '%s/users/{context}/{id}' % rootpath) add_view(config, 'leaflet.views.admin.users.UserManagementViewer', 'admin_users', permission=permission) route = 'admin_site_templates' config.add_route(route, '%s/sitetemplates/{context}/{id}' % rootpath) add_view(config, 'leaflet.views.admin.templatemgr.MainViewer', route, permission=permission) route = 'admin_sitecontent_mgr' config.add_route(route, '%s/sitecontentmgr/{context}/{id}' % rootpath) add_view(config, 'leaflet.views.admin.contentmgr.MainViewer', route, permission=permission)