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


Python Configurator.hook_zca方法代码示例

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


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

示例1: main

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import hook_zca [as 别名]
def main(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    from repoze.bfg.authentication import AuthTktAuthenticationPolicy
    from checking.authorization import RouteAuthorizationPolicy
    from checking.authentication import verifyUser

    if not settings.get("sqlalchemy.url"):
        raise ValueError("No 'sqlalchemy.url' value in application configuration.")
    config = Configurator(settings=settings,
            authentication_policy=AuthTktAuthenticationPolicy("secret",
                callback=verifyUser,
                timeout=30*60, max_age=30*60,
                reissue_time=20*60),
            authorization_policy=RouteAuthorizationPolicy())
    config.hook_zca()
    config.begin()
    setupSqlalchemy(settings)
    setupRoutes(config)
    setupChameleon(config)
    setupi18n(config)
    config.end()

    app = config.make_wsgi_app()
    app = TM(app)

    return app
开发者ID:wichert,项目名称:checking,代码行数:32,代码来源:run.py

示例2: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import hook_zca [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    names = ('src_path', 'store_url', 'cache_url', 'max_entries', 'database', 'content_dir')
    values = []
    for name in names:
        val = settings.get(name)
        if val is None: 
            raise ValueError("No ’%s’ value in application configuration." % name) 
        values.append(val)
        
    src_path, store_url, cache_url, max_entries, database, content_dir = values
    
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    config = Configurator(settings=settings, root_factory=ContentRoot(content_dir))
    # use local component registry
    config.hook_zca()
    config.begin()
    config.load_zcml(zcml_file)
    
    register_source(src_path)
    register_store(store_url, cache_url, max_entries=max_entries)
    register_catalog(database)
    config.end()
    
    return config.make_wsgi_app()
开发者ID:vilos,项目名称:rstlibrary,代码行数:31,代码来源:run.py

示例3: EPortfolioIntegrationTestCase

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import hook_zca [as 别名]
class EPortfolioIntegrationTestCase(EPortfolioTestCase):
    
    def setUp(self):
        self.config = Configurator()
        self.config.hook_zca()
        self.config.begin()
        self.config.load_zcml('eportfolio:configure.zcml')
        _initTestingDB()
        
开发者ID:FvD,项目名称:cobal.eportfolio,代码行数:10,代码来源:__init__.py


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