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


Python Configurator.load_zcml方法代码示例

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


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

示例1: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    db_string = settings.get('db_string')
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")
    initialize_sql(db_string)
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    # Ugly hack to configure the MapperExtension with the settings.
    removal_extension.path = settings.get('upload_directory')
    
    scheduler = Scheduler()
    # Send out queued mails
    from eportfolio.utilities.mail_delivery import trigger_queued_delivery
    scheduler.add_interval_job(trigger_queued_delivery, seconds=30)
    scheduler.start()
    
    return config.make_wsgi_app()
开发者ID:FvD,项目名称:cobal.eportfolio,代码行数:27,代码来源:run.py

示例2: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [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: _registerComponents

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
 def _registerComponents(self):
     # Install a bit of configuration that make_app() usually
     # does for us.
     reg = get_current_registry()
     config = Configurator(reg)
     config.setup_registry()
     config.load_zcml('opencore.includes:configure.zcml')
开发者ID:junkafarian,项目名称:opencore,代码行数:9,代码来源:tests.py

示例4: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    """
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    return config.make_wsgi_app()
开发者ID:bluedynamics,项目名称:bda.bfg.ugm,代码行数:11,代码来源:run.py

示例5: EPortfolioIntegrationTestCase

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [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

示例6: _registerComponents

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
 def _registerComponents(self):
     # Install a bit of configuration that make_app() usually
     # does for us.
     reg = get_current_registry()
     config = Configurator(reg)
     config.setup_registry()
     config.load_zcml('karl.includes:configure.zcml')
     from zope.interface import Interface
     testing.registerAdapter(DummyToolAddables, (Interface, Interface),
                             IToolAddables)
开发者ID:cguardia,项目名称:karl,代码行数:12,代码来源:tests.py

示例7: ViewIntegrationTest

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
class ViewIntegrationTest(ViewTest):
    def setUp(self):
        import seantisinvoice

        self.config = Configurator(package=seantisinvoice)
        self.config.begin()
        self.config.load_zcml("seantisinvoice:configure.zcml")
        _initTestingDB()

    def test_zcml_registration(self):
        pass
开发者ID:seantis,项目名称:seantisinvoice,代码行数:13,代码来源:tests.py

示例8: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.
    
    It is usually called by the PasteDeploy framework during 
    ``paster serve``.
    """
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    root = Root(settings.get('amqp_host', 'localhost'),
                settings.get('amqp_exchange', EXCHANGE))
    config = Configurator(root_factory=lambda request: root, settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    if settings.get('debug', None):
        return DebuggedApplication(config.make_wsgi_app(), True)
    else:
        return config.make_wsgi_app()
开发者ID:boothead,项目名称:multivisor,代码行数:19,代码来源:run.py

示例9: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def app(global_config, **settings):
    """ This function returns a WSGI application.

    It is usually called by the PasteDeploy framework during
    ``paster serve``.
    """
    zodb_uri = settings.get('zodb_uri')
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    if zodb_uri is None:
        raise ValueError("No 'zodb_uri' in application configuration.")

    finder = PersistentApplicationFinder(zodb_uri, appmaker)
    def get_root(request):
        return finder(request.environ)
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    return config.make_wsgi_app()
开发者ID:shentonfreude,项目名称:DubCore,代码行数:21,代码来源:run.py

示例10: mailin_monitor_view

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def mailin_monitor_view(context, request):
    """
    Dispatches to a subapp from repoze.mailin.monitor.  I know this looks kind
    of horrible, but this is the best way I know how to mount another object
    graph onto the root object graph in BFG 1.2.  BFG 1.3 will theoretically
    allow SCRIPT_NAME/PATH_INFO rewriting for routes of the form
    '/some/path/*traverse', making it easier to do this with just a route,
    rather than actually constituting a whole new bfg app just to serve this
    subtree.
    """
    global _mailin_monitor_app
    if _mailin_monitor_app is None:
        # Keep imports local in hopes that this can be removed when BFG 1.3
        # comes out.
        from repoze.bfg.authorization import ACLAuthorizationPolicy
        from repoze.bfg.configuration import Configurator
        from karl.models.mailin_monitor import KarlMailInMonitor
        from karl.security.policy import get_groups
        from repoze.bfg.authentication import RepozeWho1AuthenticationPolicy

        authentication_policy = RepozeWho1AuthenticationPolicy(
            callback=get_groups
        )
        authorization_policy = ACLAuthorizationPolicy()
        config = Configurator(root_factory=KarlMailInMonitor(),
                              authentication_policy=authentication_policy,
                              authorization_policy=authorization_policy)
        config.begin()
        config.load_zcml('repoze.mailin.monitor:configure.zcml')
        config.end()
        _mailin_monitor_app = config.make_wsgi_app()

    # Dispatch to subapp
    import webob
    sub_environ = request.environ.copy()
    sub_environ['SCRIPT_NAME'] = '/%s/%s' % (model_path(context),
                                            request.view_name)
    sub_environ['PATH_INFO'] = '/' + '/'.join(request.subpath)
    sub_request = webob.Request(sub_environ)
    return sub_request.get_response(_mailin_monitor_app)
开发者ID:boothead,项目名称:karl,代码行数:42,代码来源:admin.py

示例11: app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def app(global_config, **settings):
    """ This function returns a repoze.bfg.router.Router object.
    
    It is usually called by the PasteDeploy framework during ``paster serve``.
    """
    db_string = settings.get('db_string')
    if db_string is None:
        raise ValueError("No 'db_string' value in application configuration.")
    initialize_sql(db_string)
    
    # Scheduler to copy recurring invoices
    s = Scheduler()
    # Check every 5 minutes for recurring invoices
    s.add_interval_task(copy_recurring, 300)
    s.start_scheduler()
    
    config = Configurator(root_factory=RootFactory, settings=settings)
    config.begin()
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    config.load_zcml(zcml_file)
    config.end()
    return config.make_wsgi_app()
开发者ID:seantis,项目名称:seantisinvoice,代码行数:24,代码来源:run.py

示例12: wsgi_app

# 需要导入模块: from repoze.bfg.configuration import Configurator [as 别名]
# 或者: from repoze.bfg.configuration.Configurator import load_zcml [as 别名]
def wsgi_app(**settings):
  config = Configurator(root_factory=get_root, settings=settings)
  config.load_zcml('configure.zcml')
  return config.make_wsgi_app()
开发者ID:topiaruss,项目名称:bfg-gae-logger,代码行数:6,代码来源:run.py


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