コード例 #1
0
ファイル: bibtasklet.py プロジェクト: aw-bib/tind-invenio
def cli_list_tasklets():
    """
    Print the list of available tasklets and broken tasklets.
    """
    print """Available tasklets:"""
    for tasklet in _TASKLETS.values():
        print get_callable_documentation(tasklet)

    print """Broken tasklets:"""
    for tasklet_name, error in _TASKLETS.get_broken_plugins().iteritems():
        print "%s: %s" % (tasklet_name, error)
    sys.exit(0)
コード例 #2
0
def cli_list_tasklets():
    """
    Print the list of available tasklets and broken tasklets.
    """
    print """Available tasklets:"""
    for tasklet in _TASKLETS.values():
        print get_callable_documentation(tasklet)

    print """Broken tasklets:"""
    for tasklet_name, error in _TASKLETS.get_broken_plugins().iteritems():
        print "%s: %s" % (tasklet_name, error)
    sys.exit(0)
コード例 #3
0
    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)
コード例 #4
0
ファイル: goto_engine.py プロジェクト: aw-bib/tind-invenio
    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)
    elif options.update: