from flask import abort, jsonify from flask.views import View from pycs.database.Database import Database class GetProjectModel(View): """ return the model used by a given project """ # pylint: disable=arguments-differ methods = ['GET'] def __init__(self, db: Database): # pylint: disable=invalid-name self.db = db def dispatch_request(self, identifier): # find project project = self.db.project(identifier) if project is None: abort(404) # get model model = project.model() # return model return jsonify(model)