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


Python ConfigurationMachine.execute_actions方法代码示例

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


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

示例1: grok

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def grok(module_name=None):
    """Grok a module.

    Test helper to 'grok' a module named by `module_name`, a dotted
    path to a module like ``'mypkg.mymodule'``. 'grokking' hereby
    means to do all the ZCML configurations triggered by directives
    like ``grok.context()`` etc. This is only needed if your module
    was not `grokked` during test setup time as it normally happens
    with functional tests.
    """
    config = ConfigurationMachine()
    zcml.do_grok('grokcore.component.meta', config)
    zcml.do_grok('grokcore.security.meta', config)
    zcml.do_grok('grokcore.view.meta', config)
    zcml.do_grok('grokcore.view.templatereg', config)
    zcml.do_grok('grokcore.viewlet.meta', config)
    zcml.do_grok('grokcore.formlib.meta', config)
    zcml.do_grok('grokcore.annotation.meta', config)
    zcml.do_grok('grokcore.site.meta', config)
    zcml.do_grok('grokcore.catalog.meta', config)
    zcml.do_grok('grokcore.traverser.meta', config)
    zcml.do_grok('grokcore.rest.meta', config)
    zcml.do_grok('grokcore.xmlrpc.meta', config)
    if module_name is not None:
        zcml.do_grok(module_name, config)
    config.execute_actions()
开发者ID:clozinski,项目名称:grok,代码行数:28,代码来源:testing.py

示例2: grok

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def grok(*module_names):
    config = ConfigurationMachine()
    zcml.do_grok('grokcore.component.compat', config)
    zcml.do_grok('grokcore.component.meta', config)
    for module_name in module_names:
        zcml.do_grok(module_name, config)
    config.execute_actions()
开发者ID:icemac,项目名称:grokcore.component,代码行数:9,代码来源:testing.py

示例3: grok

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def grok(module_name):
    config = ConfigurationMachine()
    zcml.do_grok('grokcore.component.meta', config)
    zcml.do_grok('grokcore.site.meta', config)
    zcml.do_grok('grokcore.catalog.meta', config)
    zcml.do_grok(module_name, config)
    config.execute_actions()
开发者ID:jean,项目名称:grokcore.catalog,代码行数:9,代码来源:testing.py

示例4: load_zcml

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
 def load_zcml(self, zcml_asset_specification):
     def _get_site_manager(context=None):
         return self
     if ':' not in zcml_asset_specification:
         import alpaca
         config_package = alpaca
         config_file = zcml_asset_specification
     else:
         package_name, config_file = zcml_asset_specification.split(':')
         __import__(package_name)
         config_package = sys.modules[package_name]
     context = ConfigurationMachine()
     context.package = config_package
     xmlconfig.registerCommonDirectives(context)
     xmlconfig.file(
         config_file,
         package=config_package,
         context=context,
         execute=False
     )
     getSiteManager.sethook(_get_site_manager)
     try:
         context.execute_actions()
     finally:
         getSiteManager.reset()
开发者ID:msiedlarek,项目名称:alpaca,代码行数:27,代码来源:registry.py

示例5: configure

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def configure(arguments):
    # Enable venuasianconfiguration
    if HAS_VENUSIANCONFIGURATION:
        import venusianconfiguration
        venusianconfiguration.enable()

    # BBB: Support Zope's global configuration context
    if HAS_ZOPE:
        try:
            import Zope2.App.zcml
            config = Zope2.App.zcml._context or ConfigurationMachine()
        except (ImportError, AttributeError):
            config = ConfigurationMachine()
    else:
        config = ConfigurationMachine()

    # Parse and evaluate configuration and plugins
    registerCommonDirectives(config)

    import transmogrifier
    xmlconfig.include(config, package=transmogrifier, file='meta.zcml')
    xmlconfig.include(config, package=transmogrifier, file='configure.zcml')

    # Resolve includes
    for include in set(arguments.get('--include')):
        package, filename = parse_include(include)
        if package and filename:
            package = importlib.import_module(package)
            xmlconfig.include(config, package=package, file=filename)
        elif package and HAS_VENUSIANCONFIGURATION:
            # Support including single module in the current working directory
            import venusianconfiguration
            venusianconfiguration.venusianscan(package, config)

    config.execute_actions()
开发者ID:collective,项目名称:transmogrifier,代码行数:37,代码来源:main.py

示例6: __main__

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def __main__():
    # Enable logging
    logging.basicConfig(level=logging.INFO)

    # Parse cli arguments
    arguments = docopt(__doc__)

    # Parse and evaluate configuration and plugins
    config = ConfigurationMachine()
    registerCommonDirectives(config)
    xmlconfig.include(config, package=collective.transmogrifier,
                      file='meta.zcml')
    xmlconfig.include(config, package=collective.transmogrifier,
                      file='configure.zcml')
    config.execute_actions()

    if arguments.get('--list'):
        blueprints = dict(getUtilitiesFor(ISectionBlueprint))
        pipelines = map(configuration_registry.getConfiguration,
                        configuration_registry.listConfigurationIds())
        print """
Available blueprints
--------------------
{0:s}

Available pipelines
-------------------
{1:s}
""".format('\n'.join(sorted(blueprints.keys())),
           '\n'.join(['{0:s}\n    {1:s}: {2:s}'.format(
                      p['id'], p['title'], p['description'])
                      for p in pipelines]))
        return

    # Load optional overrides
    overrides = {}
    overrides_path = arguments.get('--overrides')
    if overrides_path and not os.path.isabs(overrides_path):
        overrides_path = os.path.join(os.getcwd(), overrides_path)
    if overrides_path:
        parser = ConfigParser.RawConfigParser()
        parser.optionxform = str  # case sensitive
        with open(overrides_path) as fp:
            parser.readfp(fp)
        overrides.update(dict(((section, dict(parser.items(section)))
                               for section in parser.sections())))

    # Initialize optional context
    context_path = arguments.get('--context')
    if context_path is None:
        context = dict()
    else:
        context_module_path, context_class_name = context_path.rsplit('.', 1)
        context_module = importlib.import_module(context_module_path)
        context = getattr(context_module, context_class_name)()

    # Transmogrify
    for pipeline in arguments.get('<pipeline>'):
        ITransmogrifier(context)(pipeline, **overrides)
开发者ID:datakurre,项目名称:collective.transmogrifier,代码行数:61,代码来源:runner.py

示例7: grok

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def grok(module_name):
    config = ConfigurationMachine()
    zcml.do_grok('grokcore.component.meta', config)
    zcml.do_grok('grokcore.security.meta', config)
    zcml.do_grok('grokcore.view.meta', config)
    zcml.do_grok('grokcore.view.templatereg', config)
    zcml.do_grok('grokcore.permission', config)
    zcml.do_grok(module_name, config)
    config.execute_actions()
开发者ID:jean,项目名称:grokcore.permission,代码行数:11,代码来源:testing.py

示例8: grok

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def grok(module_name):
    config = ConfigurationMachine()
    zcml.do_grok('grokcore.component.meta', config)
    zcml.do_grok('grokcore.view.meta.views', config)
    zcml.do_grok('grokcore.view.meta.templates', config)
    zcml.do_grok('grokcore.view.meta.skin', config)
    # Use the Five override for the page template factory
    # zcml.do_grok('grokcore.view.templatereg', config)
    zcml.do_grok('five.grok.templatereg', config)
    zcml.do_grok('five.grok.meta', config)
    zcml.do_grok(module_name, config)
    config.execute_actions()
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:14,代码来源:testing.py

示例9: zcml_configure

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def zcml_configure(name, package):
    """ Given a ZCML filename as ``name`` and a Python package as
    ``package`` which the filename should be relative to, load the
    ZCML into the current ZCML registry.

    """
    context = ConfigurationMachine()
    xmlconfig.registerCommonDirectives(context)
    context.package = package
    xmlconfig.include(context, name, package)
    context.execute_actions(clear=False) # the raison d'etre
    return context.actions
开发者ID:markramm,项目名称:pyramid,代码行数:14,代码来源:zcml.py

示例10: configure

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
 def configure(self):
     gsm = component.getGlobalSiteManager
     component.getGlobalSiteManager = get_current_registry
     manager.push({'registry': self.registry})
     try:
         context = ConfigurationMachine()
         for action in self():
             context.action(*action)
         context.execute_actions()
     finally:
         component.getGlobalSiteManager = gsm
         manager.pop()
开发者ID:malthe,项目名称:repoze.bfg.skins,代码行数:14,代码来源:zcml.py

示例11: grok

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def grok(module_name):
    config = ConfigurationMachine()
    zcml.do_grok('grokcore.component.meta', config)
    zcml.do_grok('grokcore.security.meta', config)
    zcml.do_grok('grokcore.view.meta', config)
    zcml.do_grok('grokcore.view.templatereg', config)
    zcml.do_grok('grokcore.viewlet.meta', config)
    zcml.do_grok('grokcore.formlib.meta', config)
    zcml.do_grok('grokcore.annotation.meta', config)
    zcml.do_grok('grokcore.site.meta', config)
    zcml.do_grok('grok.meta', config)
    zcml.do_grok(module_name, config)
    config.execute_actions()
开发者ID:grodniewicz,项目名称:oship,代码行数:15,代码来源:testing.py

示例12: load_zcml

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def load_zcml(*args):
    """We rely on grok to load the configuration for our modules, but we depend on some libraries which
    have only zcml based configuration, thus we need to load only those we need."""

    from zope.configuration.config import ConfigurationMachine
    from zope.configuration import xmlconfig

    context = ConfigurationMachine()
    xmlconfig.registerCommonDirectives(context)

    for i in args:
        xmlconfig.include(context, "configure.zcml", context.resolve(i))

    context.execute_actions()
开发者ID:carriercomm,项目名称:opennode-management,代码行数:16,代码来源:core.py

示例13: file

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def file(name, package=None, context=None, execute=True):
    """Execute a zcml file
    """

    if context is None:
        context = ConfigurationMachine()
        registerCommonDirectives(context)
        context.package = package

    include(context, name, package)
    if execute:
        context.execute_actions()

    return context
开发者ID:aregee,项目名称:Mailman,代码行数:16,代码来源:xmlconfig.py

示例14: string

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def string(s, context=None, name="<string>", execute=True):
    """Execute a zcml string
    """
    if context is None:
        context = ConfigurationMachine()
        registerCommonDirectives(context)

    f = StringIO(s)
    f.name = name
    processxmlfile(f, context)

    if execute:
        context.execute_actions()

    return context
开发者ID:aregee,项目名称:Mailman,代码行数:17,代码来源:xmlconfig.py

示例15: register_skin_view

# 需要导入模块: from zope.configuration.config import ConfigurationMachine [as 别名]
# 或者: from zope.configuration.config.ConfigurationMachine import execute_actions [as 别名]
def register_skin_view(relative_path, path, kwargs):
    registry = get_current_registry()

    for inst in registry.getAllUtilitiesRegisteredFor(ISkinObject):
        if inst.path == path:
            break
    else:
        raise RuntimeError("Skin object not found: %s." % relative_path)

    name = type(inst).component_name(relative_path).replace('/', '_')

    context = ConfigurationMachine()
    register_bfg_view(
        context, name=name, view=inst, **kwargs)
    context.execute_actions()
开发者ID:malthe,项目名称:repoze.bfg.skins,代码行数:17,代码来源:zcml.py


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