from flask import jsonify
from flask.views import View

from pycs.database.Project import Project


class ListLabels(View):
    """
    return a list of labels for a given project
    """
    # pylint: disable=arguments-differ
    methods = ['GET']


    def dispatch_request(self, project_id):
        # find project
        project = Project.get_or_404(project_id)

        # return labels
        return jsonify(project.labels.all())
