示例#1
0
文件: views.py 项目: mcdir/flaskbb
def disable_plugin(plugin):
    try:
        plugin = get_plugin(plugin)
    except KeyError:
        flash("Plugin {} not found".format(plugin), "danger")
        return redirect(url_for("management.plugins"))

    plugin_dir = os.path.join(
        os.path.abspath(os.path.dirname(os.path.dirname(__file__))), "plugins",
        plugin.identifier)

    disabled_file = os.path.join(plugin_dir, "DISABLED")

    open(disabled_file, "a").close()

    flash("Plugin should be disabled. Please reload your app.", "success")

    flash(
        "If you are using a host which doesn't "
        "support writting on the disk, this won't work - than you need to "
        "create a 'DISABLED' file by yourself.", "info")

    return redirect(url_for("management.plugins"))
示例#2
0
def disable_plugin(plugin):
    try:
        plugin = get_plugin(plugin)
    except KeyError:
        flash("Plugin {} not found".format(plugin), "danger")
        return redirect(url_for("management.plugins"))

    plugin_dir = os.path.join(
        os.path.abspath(os.path.dirname(os.path.dirname(__file__))),
        "plugins", plugin.identifier
    )

    disabled_file = os.path.join(plugin_dir, "DISABLED")

    open(disabled_file, "a").close()

    flash("Plugin should be disabled. Please reload your app.", "success")

    flash("If you are using a host which doesn't "
          "support writting on the disk, this won't work - than you need to "
          "create a 'DISABLED' file by yourself.", "info")

    return redirect(url_for("management.plugins"))
    def test_get_plugin(self):
        with self.app.test_request_context():
            plugin = get_plugin("test1")

        self.assertEquals(plugin, self.plugin_manager.plugins["test1"])
示例#4
0
def enable(plugin):
    plugin = get_plugin(plugin)
    plugin_manager.enable_plugins([plugin])
    return redirect(url_for("index"))
示例#5
0
    def test_get_plugin(self):
        with self.app.test_request_context():
            plugin = get_plugin("test1")

        self.assertEquals(plugin, self.plugin_manager.plugins["test1"])