From ac459031c7ed59907a9b896b6612d586836d1f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 13 Feb 2022 21:43:12 +0100 Subject: [PATCH] use marshmallow to persist memes --- mealapi/resources/mealresource.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mealapi/resources/mealresource.py b/mealapi/resources/mealresource.py index 9f79be5..ac3c7ff 100644 --- a/mealapi/resources/mealresource.py +++ b/mealapi/resources/mealresource.py @@ -16,9 +16,7 @@ class MealBaseResource(Resource): body = request.get_json() try: - mealobj = self.mealschema.load(body) - db.session.add(mealobj.data) - db.session.commit() + self.mealschema.load(body, session=db.session) return '', 204 except ValidationError as error: abort(406, error.messages)