コード例 #1
0
def plugin(plugin_name, command):
    """
    Allows a Kolibri plugin to be either enabled or disabled.
    """
    if command == ENABLE:
        logger.info(u"Enabling plugin '{}'".format(plugin_name))
        enable_plugin(plugin_name)

    if command == DISABLE:
        logger.info(u"Disabling plugin '{}'".format(plugin_name))
        disable_plugin(plugin_name)

    config.save()
コード例 #2
0
ファイル: cli.py プロジェクト: MikiasEphrem/kolibri_old
def plugin(plugin_name, **kwargs):
    """
    Receives a plugin identifier and tries to load its main class. Calls class
    functions.
    """
    if kwargs.get("enable", False):
        logger.info("Enabling Kolibri plugin {}.".format(plugin_name))
        enable_plugin(plugin_name)

    if kwargs.get("disable", False):
        logger.info("Disabling Kolibri plugin {}.".format(plugin_name))
        disable_plugin(plugin_name)

    config.save()
コード例 #3
0
ファイル: cli.py プロジェクト: bernandez/kolibri
def enable(plugin_names, default_plugins):
    error = False
    if not plugin_names and default_plugins:
        plugin_names = DEFAULT_PLUGINS
    for name in plugin_names:
        try:
            logger.info("Enabling plugin '{}'".format(name))
            error = error or not enable_plugin(name)
        except Exception as e:
            error = True
            logger.error("Error enabling plugin '{}', error was: {}".format(name, e))
    if error:
        exception = click.ClickException("One or more plugins could not be enabled")
        exception.exit_code = 2
        raise exception
コード例 #4
0
def test_can_enable_all_default_plugins(plugin):
    assert enable_plugin(plugin)