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


Python Configurator.load_zcml方法代码示例

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


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

示例1: setUp

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import load_zcml [as 别名]
 def setUp(self):
     from pyramid.configuration import Configurator
     config = Configurator(root_factory=self.root_factory)
     config.begin()
     config.load_zcml(self.config)
     app = config.make_wsgi_app()
     from webtest import TestApp
     self.testapp = TestApp(app)
     self.config = config
开发者ID:blaflamme,项目名称:pyramid,代码行数:11,代码来源:test_integration.py

示例2: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.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``.
    """
    config = Configurator(root_factory=get_root, settings=settings)
    config.begin()
    config.load_zcml('configure.zcml')
    config.end()
    return config.make_wsgi_app()
开发者ID:srid,项目名称:hydra,代码行数:13,代码来源:__init__.py

示例3: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import load_zcml [as 别名]
def app(global_config, **settings):
    db_uri = settings.get('db_uri')
    db_name = settings.get('db_name')
    if db_uri is None or db_name is None:
        raise ValueError("db_uri AND db_name must be defined"
                         " in application initilization configuration file")
    zcml_file = settings.get('configure_zcml', 'configure.zcml')
    config = Configurator(root_factory=RootFactory, settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    return config.make_wsgi_app()
开发者ID:GunioRobot,项目名称:ravel,代码行数:14,代码来源:run.py

示例4: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import load_zcml [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    zodb_uri = settings.get('zodb_uri')
    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.load_zcml('configure.zcml')
    return config.make_wsgi_app()
开发者ID:blaflamme,项目名称:pyramid,代码行数:15,代码来源:__init__.py

示例5: setUp

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import load_zcml [as 别名]
 def setUp(self):
     import sys
     import twill
     from pyramid.configuration import Configurator
     config = Configurator(root_factory=self.root_factory)
     config.load_zcml(self.config)
     twill.add_wsgi_intercept('localhost', 6543, config.make_wsgi_app)
     if sys.platform is 'win32': # pragma: no cover
         out = open('nul:', 'wb')
     else:
         out = open('/dev/null', 'wb')
     twill.set_output(out)
     testing.setUp(registry=config.registry)
开发者ID:markramm,项目名称:pyramid,代码行数:15,代码来源:test_integration.py

示例6: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import load_zcml [as 别名]
def main(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')
    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.load_zcml('configure.zcml')
    return config.make_wsgi_app()
开发者ID:blaflamme,项目名称:pyramid,代码行数:18,代码来源:__init__.py

示例7: app

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.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.")
    db_echo = settings.get('db_echo', 'false')
    initialize_sql(db_string, asbool(db_echo))
    config = Configurator(settings=settings)
    config.begin()
    config.load_zcml(zcml_file)
    config.end()
    return config.make_wsgi_app()
开发者ID:markramm,项目名称:pyramid,代码行数:20,代码来源:run.py

示例8: mailin_monitor_view

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.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 pyramid.authorization import ACLAuthorizationPolicy
        from pyramid.configuration import Configurator
        from karl.models.mailin_monitor import KarlMailInMonitor
        from karl.security.policy import get_groups
        from pyramid.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
    from pyramid.request import Request
    sub_environ = request.environ.copy()
    sub_environ['SCRIPT_NAME'] = '/%s/%s' % (resource_path(context),
                                            request.view_name)
    sub_environ['PATH_INFO'] = '/' + '/'.join(request.subpath)
    sub_request = Request(sub_environ)
    return sub_request.get_response(_mailin_monitor_app)
开发者ID:Falmarri,项目名称:karl,代码行数:42,代码来源:admin.py

示例9: app

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

    auth = RepozeWho1AuthenticationPolicy(identifier_name='basicauth')
    acl = ACLAuthorizationPolicy()

    config =  Configurator(
        root_factory=get_root,
        settings=settings,
        authorization_policy = acl,
        authentication_policy = auth,
        )
    config.begin()
    config.load_zcml(zcml_file)
    config.end() 
    return config.make_wsgi_app()
开发者ID:cswank,项目名称:brewserver,代码行数:24,代码来源:run.py

示例10: main

# 需要导入模块: from pyramid.configuration import Configurator [as 别名]
# 或者: from pyramid.configuration.Configurator import load_zcml [as 别名]
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator()
    config.begin()
    
    db_uri = settings['db_uri']
    server_url = settings['server_url']
    conn = Connection(db_uri)
    config.registry.settings['db_conn'] = conn
    config.registry.settings['server_url'] = server_url
    config.registry.settings['db_name'] = settings['db_name']
    config.add_subscriber(add_mongo_db, NewRequest)

    config.include('pyramid_zcml')
    config.load_zcml('configure.zcml')
    config.end()

    #add renderer
    #Fixme: try to insert this on zcml file 
    config.add_renderer('jsonp', JSONP(param_name='callback'))
      
    return config.make_wsgi_app()
开发者ID:chiehwen,项目名称:Analytics,代码行数:25,代码来源:__init__.py


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