from flask import abort, jsonify from flask.views import View from pycs.database.Label import Label from pycs.database.Project import Project class ListLabelTree(View): """ return a list of labels for a given project """ # pylint: disable=arguments-differ methods = ['GET'] def dispatch_request(self, identifier): project = Project.query.get(identifier) if project is None: return abort(404) return jsonify(project.label_tree())