sachet/server/views_common.py: add an extra error check on patch()

This commit is contained in:
dogeystamp 2023-04-13 11:17:44 -04:00
parent af21887402
commit 831017092a
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -100,6 +100,13 @@ class ModelAPI(MethodView):
return jsonify(model.get_schema().dump(model))
def patch(self, model):
if not model:
resp = {
"status": "fail",
"message": "This resource does not exist.",
}
return jsonify(resp), 404
model_schema = model.get_schema()
if not model: