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 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"])
def enable(plugin): plugin = get_plugin(plugin) plugin_manager.enable_plugins([plugin]) return redirect(url_for("index"))