From bfc31c9c0ecf4332fca2620dac4c326bb09ef825 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 28 Jul 2021 07:04:30 +0200 Subject: [PATCH] dffd --- drama/routes/comments.py | 2 +- drama/routes/posts.py | 2 +- drama/routes/votes.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drama/routes/comments.py b/drama/routes/comments.py index 52358cf87..553ed829d 100644 --- a/drama/routes/comments.py +++ b/drama/routes/comments.py @@ -960,7 +960,7 @@ def save_comment(cid, v): g.db.add(new_save) try: g.db.flush() - except: abort(422) + except: g.db.rollback() return "", 204 diff --git a/drama/routes/posts.py b/drama/routes/posts.py index b3d6e19ef..5b0398b5f 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -1138,7 +1138,7 @@ def save_post(pid, v): g.db.add(new_save) try: g.db.flush() - except: abort(422) + except: g.db.rollback() return "", 204 diff --git a/drama/routes/votes.py b/drama/routes/votes.py index 3fdb162e0..33823ce45 100644 --- a/drama/routes/votes.py +++ b/drama/routes/votes.py @@ -149,7 +149,8 @@ def api_vote_comment(comment_id, new, v): g.db.add(vote) - g.db.flush() + try: g.db.flush() + except: g.db.rollback() comment.upvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=1).count() comment.downvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=-1).count() g.db.add(comment)