def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ const.update_cache_values() cnf = ciocconfig.get_config(const._config_file) get_session_settings(cnf, settings) settings['mako.imports'] = ['from markupsafe import escape_silent'] settings['mako.default_filters'] = ['escape_silent'] authn_policy = SessionAuthenticationPolicy(callback=groupfinder) authz_policy = ACLAuthorizationPolicy() config = Configurator( settings=settings, root_factory=RootFactory, default_permission='public', request_factory='featuredb.lib.request.CommunityManagerRequest', authentication_policy=authn_policy, authorization_policy=authz_policy) config.include('pyramid_redis_sessions') config.add_route('enhancement', 'enhancement/{id:\d+}') config.add_route('enhancementupdate', 'enhancement/{action}') config.add_route('search_index', '/') config.add_route('search_results', 'results') config.add_route('report', 'report') config.add_route('suggestions', 'suggestions') config.add_route('suggestion_delete', 'suggestions/delete') config.add_route('concerns', 'concerns') # config.add_route('priority', 'priority') config.add_route('login', 'login') config.add_route('logout', 'logout') config.add_route('pwreset', 'pwreset') config.add_route('register', 'register') config.add_route('priority', 'priority') config.add_route('suggest', 'suggest') config.add_route('account', 'account') config.add_static_view('static', 'featuredb:static', cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) config.add_static_view('/', 'featuredb:static', cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) config.scan() return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ const.update_cache_values() cnf = ciocconfig.get_config(const._config_file) get_session_settings(cnf, settings) settings['mako.imports'] = ['from markupsafe import escape_silent'] settings['mako.default_filters'] = ['escape_silent'] authn_policy = SessionAuthenticationPolicy(callback=groupfinder) authz_policy = ACLAuthorizationPolicy() config = Configurator( settings=settings, root_factory=RootFactory, default_permission='public', request_factory='featuredb.lib.request.CommunityManagerRequest', authentication_policy=authn_policy, authorization_policy=authz_policy ) config.include('pyramid_redis_sessions') config.add_route('enhancement', 'enhancement/{id:\d+}') config.add_route('enhancementupdate', 'enhancement/{action}') config.add_route('search_index', '/') config.add_route('search_results', 'results') config.add_route('report', 'report') config.add_route('suggestions', 'suggestions') config.add_route('suggestion_delete', 'suggestions/delete') config.add_route('concerns', 'concerns') # config.add_route('priority', 'priority') config.add_route('login', 'login') config.add_route('logout', 'logout') config.add_route('pwreset', 'pwreset') config.add_route('register', 'register') config.add_route('priority', 'priority') config.add_route('suggest', 'suggest') config.add_route('account', 'account') config.add_static_view('static', 'featuredb:static', cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) config.add_static_view('/', 'featuredb:static', cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) config.scan() return config.make_wsgi_app()
from operator import attrgetter import os import sys import traceback sys.path.append(os.path.dirname(os.path.dirname(__file__))) # 3rd party from pyramid.paster import bootstrap from pyramid.renderers import render import isodate # this app from featuredb.lib import email, const, config, connection const.update_cache_values() def main(argv): args = parse_args(argv) retval = 0 bootstrap(args.pyramid_config) try: args.config = config.get_config(args.configfile) except Exception: sys.stderr.write('ERROR: Could not process config file:\n') sys.stderr.write(traceback.format_exc()) return 1 args.connmgr = connection.ConnectionManager(args)