def plugin_disable(id): plugin = PluginRegistry.get_by_id(id) plugin.enabled = False plugin.save() flash( lazy_gettext("The plugin is disabled, Please restart flask-shop now!"), "info") return redirect(url_for("dashboard.plugin_list"))
def load_plugins(app): app.pluggy.add_hookspecs(spec) for name, module in sys.modules.items(): if name.startswith("flaskshop"): app.pluggy.register(module) app.pluggy.load_setuptools_entrypoints("flaskshop_plugins") try: with app.app_context(): for name in app.pluggy.external_plugins: plugin, _ = PluginRegistry.get_or_create(name=name) if not plugin.enabled: app.pluggy.set_blocked(plugin.name) except: # when db migrate raise exception pass
def plugin_enable(id): plugin = PluginRegistry.get_by_id(id) plugin.enabled = True plugin.save() flash("The plugin is enabled, Please restart flask-shop now!", "success") return redirect(url_for("dashboard.plugin_list"))