def save_enabled_plugin_flows_for_plugin_type(plugin_type, library_id, plugin_flow): """ Save a plugin flow given the plugin type and library ID :param plugin_type: :param library_id: :param plugin_flow: :return: """ plugins = PluginsHandler() return plugins.set_plugin_flow(plugin_type, library_id, plugin_flow)
def set_installed_plugin_flow(self, *args, **kwargs): request_dict = json.loads(self.request.body) plugin_type = request_dict.get('plugin_type') if not plugin_type: # Return failure self.write( json.dumps({ "success": False, "error": "Missing plugin_type" })) return flow = request_dict.get('flow', []) plugins = PluginsHandler() success = plugins.set_plugin_flow(plugin_type, flow) if success: # Return success self.write(json.dumps({"success": True})) else: # Return failure self.write(json.dumps({"success": False}))