def convert(self, plugin, scope, hashkey): data = self.base_convert(plugin) data.update(dict( remove_url=api_url_for("plugin_views", PluginActionView, plugin_hashkey=plugin.hashkey, scope=scope, hashkey=hashkey, action="remove"), configure_url=api_url_for("plugin_views", PluginActionView, plugin_hashkey=plugin.hashkey, scope=scope, hashkey=hashkey, action="configure"), add_url=api_url_for("plugin_views", PluginActionView, plugin_hashkey=plugin.hashkey, scope=scope, hashkey=hashkey, action="add") )) return data
def get_url(self, scope, hashkey, plugin_key, view_key): return api_url_for( 'plugin_views', PluginViewsDetail, scope=scope, hashkey=hashkey, plugin_hashkey=plugin_key, view_hashkey=view_key )
def get(self, scope, hashkey): from app import db context, mod = get_context_for_scope(scope, hashkey) resource_data = db.session.query(ResourceData).filter(getattr(ResourceData, scope) == mod).all() resources = [] for r in resource_data: data = self.convert(scope, hashkey, r) url = api_url_for("resource_views", ResourceDetail, resource_hashkey=data['hashkey'], scope=scope, hashkey=hashkey) data['url'] = url resources.append(data) return resources
def get(self, scope, hashkey): from app import db context, mod = get_context_for_scope(scope, hashkey) resource_data = db.session.query(ResourceData).filter(getattr(ResourceData, scope) == mod).all() resources = [] for r in resource_data: data = self.convert(scope, hashkey, r) url = api_url_for( "resource_views", ResourceDetail, resource_hashkey=data["hashkey"], scope=scope, hashkey=hashkey ) data["url"] = url resources.append(data) return resources
def get_task_url(self, task_id): from core.tasks.task_views import TaskStatus if task_id is not None: return api_url_for('task_views', TaskStatus, task_id=task_id) return None