6
0

ListLabelTree.py 496 B

12345678910111213141516171819202122
  1. from flask import abort, jsonify
  2. from flask.views import View
  3. from pycs.database.Label import Label
  4. from pycs.database.Project import Project
  5. class ListLabelTree(View):
  6. """
  7. return a list of labels for a given project
  8. """
  9. # pylint: disable=arguments-differ
  10. methods = ['GET']
  11. def dispatch_request(self, identifier):
  12. project = Project.query.get(identifier)
  13. if project is None:
  14. return abort(404)
  15. return jsonify(project.label_tree())