本文整理汇总了Python中invenio.pluginutils.PluginContainer.items方法的典型用法代码示例。如果您正苦于以下问题:Python PluginContainer.items方法的具体用法?Python PluginContainer.items怎么用?Python PluginContainer.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio.pluginutils.PluginContainer
的用法示例。
在下文中一共展示了PluginContainer.items方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plugin
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import items [as 别名]
redirection_group.add_option("-r", "--register-redirection", metavar="LABEL", action="store", dest="register", help="Register a redirection with the provided LABEL")
redirection_group.add_option("-u", "--update-redirection", metavar="LABEL", action="store", dest="update", help="Update the redirection specified by the provided LABEL")
redirection_group.add_option("-g", "--get-redirection", metavar="LABEL", action="store", dest="get_redirection", help="Get all information about a redirection specified by LABEL")
redirection_group.add_option("-d", "--drop-redirection", metavar="LABEL", action="store", dest="drop_redirection", help="Drop an existing redirection specified by LABEL")
parser.add_option_group(redirection_group)
specific_group = optparse.OptionGroup(parser, "Specific Options")
specific_group.add_option("-P", "--plugin", metavar="PLUGIN", action="store", dest="plugin", help="Specify the plugin to use when registering or updating a redirection")
specific_group.add_option("-j", "--json-parameters", metavar="PARAMETERS", action="callback", type="string", callback=get_json_parameters_from_cli, help="Specify the parameters to provide to the plugin (serialized in JSON)")
specific_group.add_option("-p", "--parameter", metavar="PARAM=VALUE", action="callback", callback=get_parameter_from_cli, help="Specify a single PARAM=VALUE parameter to be provided to the plugin (alternative to the JSON serialization)", type="string")
parser.add_option_group(specific_group)
(options, dummy_args) = parser.parse_args()
if options.action == "list-goto-plugins":
print "GOTO plugins found:"
for component, goto in CFG_GOTO_PLUGINS.items():
print component + ' -> ' + get_callable_documentation(goto)
elif options.action == 'list-broken-goto-plugins':
print "Broken GOTO plugins found:"
for component, error in CFG_GOTO_PLUGINS.get_broken_plugins().items():
print component + '->' + str(error)
elif options.register:
label = options.register
plugin = options.plugin
parameters = getattr(options, 'parameters', {})
if not plugin in CFG_GOTO_PLUGINS:
parser.error("%s is not a valid plugin" % plugin)
if is_redirection_label_already_taken(label):
parser.error("The specified label %s is already taken" % label)
register_redirection(label, plugin, parameters)
print "The redirection %s was successfully registered for the plugin %s with parameters %s" % (label, plugin, parameters)