当前位置: 首页>>代码示例>>Python>>正文


Python Configurator.formalchemy_admin方法代码示例

本文整理汇总了Python中pyramid.config.Configurator.formalchemy_admin方法的典型用法代码示例。如果您正苦于以下问题:Python Configurator.formalchemy_admin方法的具体用法?Python Configurator.formalchemy_admin怎么用?Python Configurator.formalchemy_admin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.config.Configurator的用法示例。


在下文中一共展示了Configurator.formalchemy_admin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    appmaker(engine)
    config = Configurator(settings=settings, session_factory=my_session_factory, root_factory='moneypot.RootFactory')
    config.add_translation_dirs('moneypot:locale')

    if settings['debugmail'] == 'true':
        config.include('pyramid_mailer.testing')
    else:
        config.include('pyramid_mailer')

    auth_policy = AuthTktAuthenticationPolicy(secret='thisshouldbesecret')
    authz_policy = ACLAuthorizationPolicy()
    config.set_authentication_policy(auth_policy)
    config.set_authorization_policy(authz_policy)

    config.add_static_view('static', 'moneypot:static', cache_max_age=3600)

    config.include('pyramid_formalchemy')
    # Adding the jquery libraries
    config.include('fa.bootstrap')
    # Adding the package specific routes
    config.include('moneypot.routes')

    config.formalchemy_admin("/admin",
                             models=models,
                             forms=forms,
                             session_factory=models.DBSession,
                             view="moneypot.forms.ModelView")

    config.scan()

    return config.make_wsgi_app()
开发者ID:NemesisSOAD,项目名称:moneypot,代码行数:37,代码来源:__init__.py

示例2: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    config = Configurator(settings=settings)
    config.add_static_view('static', 'pyramidapp:static')
    config.add_route('home', '/')
    config.add_view('pyramidapp.views.my_view',
                    route_name='home',
                    renderer='templates/mytemplate.pt')

    # pyramid_formalchemy's configuration
    config.include('pyramid_fanstatic')
    config.include('pyramid_formalchemy')
    config.include('fa.jquery')

    # register an admin UI
    config.formalchemy_admin('/admin', package='pyramidapp', view='fa.jquery.pyramid.ModelView')

    # register an admin UI for a single model
    config.formalchemy_model('/foo', package='pyramidapp',
                                    view='fa.jquery.pyramid.ModelView',
                                    model='pyramidapp.models.Foo')

    return config.make_wsgi_app()
开发者ID:FormAlchemy,项目名称:pyramid_formalchemy,代码行数:28,代码来源:jquery.py

示例3: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    models.initialize_sql(engine)
    config = Configurator(settings=settings)

    # pyramid_formalchemy's configuration
    config.include('pyramid_formalchemy')
    config.include('fa.jquery')

    # Admin UI (Used for the demo. Not really useful here...)
    config.formalchemy_admin('/admin', package='formalchemy_project', view='fa.jquery.pyramid.ModelView')

    # Article admin UI. Use a custom query_factory to filter by user

    # Here is the interesting part
    def query_factory(request, query, id=None):
        """this query factory use request.matchdict to retrieve user's
        articles. Of course, you can do anything like check that the user found
        in matchdict is the REMOTE_USER"""
        user = request.session_factory.query(models.User).filter_by(name=request.matchdict['user']).one()
        if id:
            return query.filter_by(user=user, id=id).one()
        else:
            return query.filter_by(user=user)

    config.formalchemy_model('/articles/{user}', package='formalchemy_project',
                             model='formalchemy_project.models.Article',
                             query_factory=query_factory,
                             view='fa.jquery.pyramid.ModelView')

    return config.make_wsgi_app()
开发者ID:do3cc,项目名称:formalchemy_project,代码行数:35,代码来源:__init__.py

示例4: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    session_factory = session_factory_from_settings(settings)
    config = Configurator(settings=settings)
    config.set_session_factory(session_factory)
    config.registry.registerUtility(DBSession, IDBSession)
    config.set_authentication_policy(SessionAuthenticationPolicy())
    config.set_authorization_policy(ACLAuthorizationPolicy())
    # config.scan_horus(models)
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.scan_horus(models)
    config.add_route('index', '/')
    config.add_route('course_intro', '/{course}/intro/')
    config.add_route('lesson', '/{course}/{lesson}/')
    config.add_route('lesson_rest', '/rest/{course}/{lesson}/')
    config.add_notfound_view(notfound, append_slash=True)
    config.include('horus')
    config.include('pyramid_mailer')
    # formalchemy
    config.include('pyramid_formalchemy')
    config.include('pyramid_fanstatic')
    config.include('fa.jquery')
    # register an admin UI
    config.formalchemy_admin('/admin', package='timtec', view='fa.jquery.pyramid.ModelView')
    config.add_route('login', '/login')
    config.add_route('logout', '/logout')
    config.scan()
    return config.make_wsgi_app()
开发者ID:hacklabr,项目名称:teste,代码行数:34,代码来源:__init__.py

示例5: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(
        root_factory=Root, settings=settings,
        locale_negotiator=locale_negotiator,
        authentication_policy=create_authentication(settings))

    config.add_settings({'srid': 3857})

    config.include('c2cgeoportal')

    config.add_translation_dirs('c2cgp_minimal:locale/')

    if asbool(config.get_settings().get('enable_admin_interface')):
        config.formalchemy_admin('admin', package='c2cgp_minimal',
                                 view='fa.jquery.pyramid.ModelView',
                                 factory=FAModels)

    config.add_route('checker_all', '/checker_all')

    # scan view decorator for adding routes
    config.scan()

    # add the main static view
    config.add_static_view(
        'proj', 'c2cgp_minimal:static',
        cache_max_age=int(config.get_settings()["default_max_age"])
    )

    # mobile views and routes
    config.add_route('mobile_index_dev', '/mobile_dev/')
    config.add_view('c2cgeoportal.views.entry.Entry',
                    attr='mobile',
                    renderer='c2cgp_minimal:static/mobile/index.html',
                    route_name='mobile_index_dev')
    config.add_route('mobile_config_dev', '/mobile_dev/config.js')
    config.add_view('c2cgeoportal.views.entry.Entry',
                    attr='mobileconfig',
                    renderer='c2cgp_minimal:static/mobile/config.js',
                    route_name='mobile_config_dev')
    config.add_static_view('mobile_dev', 'c2cgp_minimal:static/mobile')

    config.add_route('mobile_index_prod', '/mobile/')
    config.add_view('c2cgeoportal.views.entry.Entry',
                    attr='mobile',
                    renderer='c2cgp_minimal:static/mobile/build/production/App/index.html',
                    route_name='mobile_index_prod')
    config.add_route('mobile_config_prod', '/mobile/config.js')
    config.add_view('c2cgeoportal.views.entry.Entry',
                    attr='mobileconfig',
                    renderer='c2cgp_minimal:static/mobile/build/production/App/config.js',
                    route_name='mobile_config_prod')
    config.add_static_view('mobile', 'c2cgp_minimal:static/mobile/build/production/App')

    return config.make_wsgi_app()
开发者ID:pgiraud,项目名称:c2cgp_minimal,代码行数:58,代码来源:__init__.py

示例6: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    config = Configurator(settings=settings)

    # pyramid_formalchemy's configuration
    config.include('pyramid_formalchemy')
    config.include('fa.jquery')
    config.formalchemy_admin('admin', package='formalchemy_project', view='fa.jquery.pyramid.ModelView')

    return config.make_wsgi_app()
开发者ID:strogo,项目名称:formalchemy_project,代码行数:15,代码来源:__init__.py

示例7: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    authentication_policy = AuthTktAuthenticationPolicy(settings.get('authtkt_secret'),
           callback=defaultgroupsfinder) 
    config = Configurator(root_factory=Root, settings=settings,
            locale_negotiator=locale_negotiator, 
            authentication_policy=authentication_policy)

    config.add_settings({'srid': 900913})
    config.add_settings({'check_print_template': '1 A4 portrait'})
    config.add_settings({'check_FullTextSearch': 'te'})

    config.include('c2cgeoportal')

    config.add_translation_dirs('gpmap:locale/')

    config.formalchemy_admin('admin', package='gpmap',
            view='fa.jquery.pyramid.ModelView', factory=FAModels)

    config.add_route('checker_all', '/checker_all')

    # scan view decorator for adding routes
    config.scan()

    # add the main static view
    config.add_static_view('proj', 'gpmap:static')

    # mobile views and routes
#    config.add_route('mobile_index_dev', '/mobile_dev/')
#    config.add_view('c2cgeoportal.views.mobile.index',
#                    renderer='gpmap:static/mobile/index.html',
#                    route_name='mobile_index_dev')
#    config.add_route('mobile_config_dev', '/mobile_dev/config.js')
#    config.add_view('c2cgeoportal.views.mobile.config',
#                    renderer='gpmap:static/mobile/config.js',
#                    route_name='mobile_config_dev')
#    config.add_static_view('mobile_dev', 'gpmap:static/mobile')
#
#    config.add_route('mobile_index_prod', '/mobile/')
#    config.add_view('c2cgeoportal.views.mobile.index',
#                    renderer='gpmap:static/mobile/build/production/index.html',
#                    route_name='mobile_index_prod')
#    config.add_route('mobile_config_prod', '/mobile/config.js')
#    config.add_view('c2cgeoportal.views.mobile.config',
#                    renderer='gpmap:static/mobile/build/production/config.js',
#                    route_name='mobile_config_prod')
#    config.add_static_view('mobile', 'gpmap:static/mobile/build/production')

    return config.make_wsgi_app()
开发者ID:sbrunner,项目名称:gpmap,代码行数:52,代码来源:__init__.py

示例8: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    models.initialize_sql(engine)
    config = Configurator(settings=settings)
    config.include('pyramid_tm')
    config.add_translation_dirs('formalchemy_project:locale/')

    # pyramid_formalchemy's configuration
    config.include('pyramid_formalchemy')
    config.include('fa.bootstrap')
    config.include('fa.extjs')

    # Admin UI (Used for the demo. Not really useful here...)
    config.formalchemy_admin('/admin', package='formalchemy_project', view='fa.bootstrap.views.ModelView')

    return config.make_wsgi_app()
开发者ID:FormAlchemy,项目名称:formalchemy_project,代码行数:20,代码来源:fa_bootstrap.py

示例9: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    config = Configurator(settings=settings)
    config.add_static_view('static', 'pyramidapp:static')
    config.add_route('home', '/')
    config.add_view('pyramidapp.views.my_view',
                    route_name='home',
                    renderer='templates/mytemplate.pt')

    # pyramid_formalchemy's configuration
    config.include('pyramid_formalchemy')

    # register an admin UI
    config.formalchemy_admin('admin', package='pyramidapp')

    # register an admin UI for a single model
    config.formalchemy_model('foo', package='pyramidapp', model='pyramidapp.models.Foo')

    # register custom model listing
    config.formalchemy_model_view('admin',
                                  model='pyramidapp.models.Foo',
                                  context='pyramid_formalchemy.resources.ModelListing',
                                  renderer='templates/foolisting.pt',
                                  attr='listing',
                                  request_method='GET',
                                  permission='view')

    # register custom model view
    config.formalchemy_model_view('admin',
                                  model='pyramidapp.models.Foo',
                                  context='pyramid_formalchemy.resources.Model',
                                  name='',
                                  renderer='templates/fooshow.pt',
                                  attr='show',
                                  request_method='GET',
                                  permission='view')

    return config.make_wsgi_app()
开发者ID:FormAlchemy,项目名称:pyramid_formalchemy,代码行数:43,代码来源:__init__.py

示例10: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, "sqlalchemy.")
    initialize_sql(engine)

    # configure the security stuff
    config = Configurator(
        settings=settings,
        authentication_policy=RemoteUserAuthenticationPolicy(),
        authorization_policy=ACLAuthorizationPolicy(),
    )

    config.add_static_view("static", "pyramidapp:static")
    config.add_route("home", "/", view="pyramidapp.views.my_view", view_renderer="templates/mytemplate.pt")

    # pyramid_formalchemy's configuration
    config.include("pyramid_formalchemy")
    config.formalchemy_admin("admin", package="pyramidapp", factory=ModelsWithACL)  # use the secure factory

    return config.make_wsgi_app()
开发者ID:bbinet,项目名称:pyramid_formalchemy,代码行数:23,代码来源:security.py

示例11: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.bind = engine
    config = Configurator(settings=settings)

    # pyramid_chameleon's configuration
    config.include('pyramid_chameleon')

    # pyramid_formalchemy's configuration
    config.include('pyramid_formalchemy')

    # Add fanstatic tween
    config.include('pyramid_fanstatic')

    # Adding the jquery libraries
    config.include('fa.jquery')

    # register an admin UI
    config.formalchemy_admin('admin', package='budget',
            view='fa.jquery.pyramid.ModelView')

    # register static assets
    config.add_static_view('static', 'static', cache_max_age=3601)

    # all other routes...
    config.add_route('root', '/')
    config.add_route('stats', '/stats/{graph}')
    config.add_route('stats_index', '/stats')
    config.add_route('reservation', '/reservation/{loc}')
    config.add_route('cost_allocation', '/cost_allocation/{type}')

    # custom renderers
    config.add_renderer('csv', 'budget.renderers.CSVRenderer')

    config.scan()
    return config.make_wsgi_app()
开发者ID:blentz,项目名称:cloud-costs,代码行数:41,代码来源:__init__.py

示例12: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    appmaker(engine)
    config = Configurator(settings=settings)
    config.add_static_view('static', 'pybr9fabootstrap_example:static', cache_max_age=3600)
    config.add_view('pybr9fabootstrap_example.views.view_home',
                    name="",
                    renderer="templates/home.pt")

    config.include('pyramid_formalchemy')
    # Adding the jquery libraries
    config.include('fa.bootstrap')
    # Adding the package specific routes
    config.include('pybr9fabootstrap_example.routes')

    config.formalchemy_admin("/admin",
                             models=models,
                             forms=forms,
                             session_factory=models.DBSession,
                             view="pybr9fabootstrap_example.forms.ModelView")

    return config.make_wsgi_app()
开发者ID:rudaporto,项目名称:pybr9.fabootstrap_example,代码行数:26,代码来源:__init__.py

示例13: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    settings['mail.port'] = settings.get('mail_port', None) and int(settings['mail.port']) or 25
    globalreg = getGlobalSiteManager()
    set_cache_regions_from_settings(settings)
    config = Configurator(registry=globalreg)

    config.include('pyramid_zcml')
    config.load_zcml('workflow.zcml')
    config.add_translation_dirs('penelope.core:locale')

    from penelope.core.views import PORRequest
    config.setup_registry(settings=settings,
                          request_factory=PORRequest,
                          root_factory='penelope.core.views.DefaultContext')

    # por security
    from penelope.core import security
    authentication_policy = RepozeWho1AuthenticationPolicy(identifier_name="auth_tkt",callback=security.rolefinder)
    config._set_authentication_policy(authentication_policy)
    authorization_policy = ACLAuthorizationPolicy()
    config._set_authorization_policy(authorization_policy)
    config.scan('penelope.core.security.views')
    config.include('penelope.core.security.openid2')
    config.include('velruse.store.memstore')
    config.add_view('penelope.core.security.views.forbidden', renderer='skin', context="pyramid.httpexceptions.HTTPForbidden")

    #mailier
    config.include('pyramid_mailer')

    # penelope.core.models's configuration
    config.include('penelope.core.models')
    import penelope.core.events; penelope.core.events
    import penelope.core.breadcrumbs; penelope.core.breadcrumbs
    import penelope.core.sidebar; penelope.core.sidebar

    session_factory = session_factory_from_settings(settings)
    config.set_session_factory(session_factory)

    config.add_static_view('static', 'penelope.core:static')
    config.scan('penelope.core.views')
    config.add_route('socketio', 'socket.io/*remaining')
    config.scan('penelope.core.socketspace')

    config.add_route('tp', '/tp/*traverse', factory='penelope.core.tp.TPContext')
    config.scan('penelope.core.tp')
    config.scan('penelope.core.smartadd')
    config.scan('penelope.core.backlog')

    config.add_route('administrator', '/manage', factory='penelope.core.manage.ManageContext')
    config.add_route('manage_svn_authz', '/manage/svn_authz', factory='penelope.core.manage.ManageContext')
    config.add_route('manage_costs', '/manage/costs', factory='penelope.core.manage.ManageContext')
    config.scan('penelope.core.manage')

    config.add_route('search', '/search')
    config.scan('penelope.core.search')

    config.add_route('reports', '/reports/*traverse', factory='penelope.core.reports.ReportContext')
    config.scan('penelope.core.reports')
    config.add_renderer(name='xls_report', factory='penelope.core.renderers.XLSReportRenderer')
    config.add_renderer(name='csv_report', factory='penelope.core.renderers.CSVReportRenderer')

    config.include('pyramid_rpc.jsonrpc')
    config.add_jsonrpc_endpoint('DashboardAPI', '/apis/json/dashboard')
    config.scan('penelope.core.api')

    config.add_renderer('skin', renderer_factory)
    config.include('pyramid_skins')
    config.register_path("penelope.core:skins", discovery=DISCOVERY)

    # penelope.core.gdata configuration
    config.include('penelope.core.gdata')

    # pyramid_formalchemy's configuration
    config.include('pyramid_formalchemy')
    config.include('fa.bootstrap')
    config.include('deform_bootstrap')

    config.formalchemy_admin('admin',
                             package='penelope.core',
                             factory='penelope.core.forms.CrudModels',
                             models='penelope.core.models',
                             view='penelope.core.forms.ModelView',
                             session_factory='penelope.core.models.DBSession')

    config.add_view(context='pyramid_formalchemy.resources.ModelListing',
                    renderer='fa.bootstrap:templates/admin/new.pt',
                    request_method='POST',
                    route_name='admin',
                    request_type='penelope.core.interfaces.IPorRequest',
                    view='penelope.core.forms.security_create')

    config.add_static_view('deform_static', 'deform:static')
    config.add_route('navbar', '/navbar')
    config.add_route('favicon', '/favicon.ico')
    config.add_route('inbound_email', '/inbound_email')
    config.scan('penelope.core.notifications')

    from penelope.core.forms import include_forms
#.........这里部分代码省略.........
开发者ID:getpenelope,项目名称:penelope.core,代码行数:103,代码来源:__init__.py

示例14: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]

#.........这里部分代码省略.........
                          authorization_policy=authz_policy)
    config.begin()
    session_factory = session_factory_from_settings(settings)
    config.include(pyramid_handlers.includeme)
    config.set_session_factory(session_factory)

    config.add_static_view('static', 'gateway:static/')
    config.include('pyramid_mailer')

    config.add_view(view='gateway.handlers.forbidden_view',
                    renderer='forbidden.mako',
                    context=Forbidden)

    config.add_view(view='gateway.handlers.not_found',
                    context=NotFound)

    config.add_route('add',
                     '/add/{class}',
                     renderer='add.mako',
                     permission='admin',
                     view='gateway.handlers.AddClass')

    config.add_route('delete',
                     '/delete/jobs',
                     permission='view',
                     view='gateway.handlers.DeleteJobs')

    config.add_route('edit',
                     '/edit/{class}/{id}',
                     renderer='edit.mako',
                     permission='admin',
                     view='gateway.handlers.EditModel',)

    config.add_route('index',
                     '/',
                     renderer='index.mako',
                     view='gateway.handlers.Index')

    config.add_handler('twilio',
                       'twilio/{action}',
                       handler='gateway.handlers:TwilioHandler')

    config.add_handler('alerts',
                       '/alerts/{action}',
                       'gateway.handlers:AlertHandler')

    config.add_handler('dashboard', '/dashboard',
                       'gateway.handlers:Dashboard',
                       action='index')

    config.add_handler('main', '/:action',
                      handler='gateway.handlers:Dashboard')

    config.add_handler('manage', '/manage/:action',
                       handler='gateway.handlers:ManageHandler')

    config.add_handler('interfaces', '/interface/:action/:id',
                       handler='gateway.handlers:InterfaceHandler'),

    config.add_handler('export-load', 'system/:action',
                       handler='gateway.sys:ExportLoadHandler')

    config.add_handler('users', 'user/:action',
                       handler='gateway.handlers:UserHandler')

    config.add_handler('meter', 'meter/:action/:id',
                       handler='gateway.handlers:MeterHandler')

    config.add_handler('circuit', 'circuit/:action/:id',
                       handler='gateway.handlers:CircuitHandler')

    config.add_handler('logs', 'logs/:action/:meter/',
                       handler='gateway.handlers:LoggingHandler')

    config.add_handler('jobs', 'jobs/:action/:id/',
                       handler='gateway.handlers:JobHandler')

    config.add_handler('sms', 'sms/:action',
                       handler='gateway.handlers:SMSHandler')

    config.add_handler('message', 'message/:action/:id',
                       handler='gateway.handlers:MessageHandler')

    config.add_handler('account', 'account/:action/:id',
                       handler='gateway.handlers:AccountHandler')

    config.add_handler('token', 'token/:action/:id',
                       handler='gateway.handlers:TokenHandler')

    config.add_subscriber('gateway.subscribers.add_renderer_globals',
                          'pyramid.events.BeforeRender')

    config.include('pyramid_formalchemy')
    config.include('fa.jquery')
    config.formalchemy_admin('admin',
                             package='gateway',
                             view='fa.jquery.pyramid.ModelView')

    config.end()
    return config.make_wsgi_app()
开发者ID:SEL-Columbia,项目名称:gateway,代码行数:104,代码来源:__init__.py

示例15: main

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import formalchemy_admin [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    create_session(engine)
    #initialize_sql()
    authn_policy = AuthTktAuthenticationPolicy('fluidnexus', callback=groupfinder)
    authz_policy = ACLAuthorizationPolicy()
    session_factory = session_factory_from_settings(settings)
    set_cache_regions_from_settings(settings)
    config = Configurator(settings=settings,
                          session_factory = session_factory,
                         root_factory='fluidnexus.models.RootFactory',
                         authentication_policy = authn_policy,
                         authorization_policy=authz_policy)
    config.include("pyramid_formalchemy")
    config.include("fa.jquery")
    config.add_static_view('static', 'fluidnexus:static')

    config.add_route('home', '/')
    config.add_route('openid', '/openid')
    config.add_route("check_openid", pattern = "/check_openid")
    config.add_route("verify_openid", pattern = "/do_openid", view = "pyramid_openid.verify_openid")
    config.add_route('rss', '/feed/rss')

    # USERS/LOGIN
    config.add_route('login', '/login')
    config.add_route('logout', '/logout')
    config.add_route('forgot_password', '/forgot_password')
    config.add_route('reset_password', '/reset_password/{token}')
    config.add_route('register_user', "/register")
    config.add_route('register_user_openid', "/register_openid")
    config.add_route("edit_users", "/admin/users")
    config.add_route("edit_user", "/admin/users/edit/{user_id}")
    config.add_route("view_user", "/users/{user_id}")

    # BLOG POSTS
    config.add_route("view_blog", "/blog/{page_num}")
    config.add_route("view_blog_nopagenum", "/blog")
    config.add_route("view_blog_post", "/blog/post/{post_id}")
    config.add_route("edit_blog", "/admin/blog") 
    config.add_route("edit_blog_post", "/admin/blog/edit/{post_id}")
    config.add_route("new_blog_post", "/admin/blog/new")

    # PAGES
    config.add_route("new_page", "/admin/page/new")
    config.add_route("edit_pages", "/admin/pages")
    config.add_route("edit_page", "/admin/pages/edit/{page_id}")
    #config.add_route("view_page", "/{page_location}")

    # SITE PAGES
    config.add_route("credits", "/credits")
    config.add_route("download", "/download")
    config.add_route("infos", "/infos")
    config.add_route("infos_concept", "/infos/concept")
    config.add_route("infos_manual", "/infos/manual")
    config.add_route("infos_screenshots", "/infos/screenshots")
    config.add_route("infos_nexus", "/infos/nexus")
    config.add_route("infos_faq", "/infos/faq")
    config.add_route("infos_videos", "/infos/videos")


    # NEXUS
    config.add_route("view_nexus_messages", "/nexus/{page_num}")
    config.add_route("view_nexus_messages_nopagenum", "/nexus")
    config.add_route("view_nexus_message", "/nexus/message/{message_id}")

    # API
    config.add_route("api_request_key", "/api/01/request_key")
    config.add_route("api_request_token", "/api/01/request_token/{appType}")
    config.add_route("api_authorize_token", "/api/01/authorize_token/{appType}")
    config.add_route("api_do_authorize_token", "/api/01/do_authorize_token/{appType}")
    config.add_route("api_access_token", "/api/01/access_token")
    config.add_route("api_nexus_messages_json", "/api/01/nexus/messages.json")
    config.add_route("api_nexus_messages_hash_json", "/api/01/nexus/messages/{hash}.json")
    config.add_route("api_nexus_hashes_json", "/api/01/nexus/hashes.json")
    config.add_route("api_nexus_hashes_hash_json", "/api/01/nexus/hashes/{hash}.json")
    # The following API method requires oauth authorization
    config.add_route("api_nexus_message_nonce", "/api/01/nexus/message/nonce.json") 
    # This API call requires the nonce retrieved through the previous call
    config.add_route("api_nexus_message_update", "/api/01/nexus/message/update.json") 


    config.formalchemy_admin('/admin', package="fluidnexus", view="fa.jquery.pyramid.ModelView", factory=FormAlchemyRootFactory)
    config.scan()
    return config.make_wsgi_app()
开发者ID:zeitkunst,项目名称:FluidNexusWebsite,代码行数:88,代码来源:__init__.py


注:本文中的pyramid.config.Configurator.formalchemy_admin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。