diff --git a/drama/routes/comments.py b/drama/routes/comments.py index 52358cf87b..553ed829d7 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 b3d6e19efd..5b0398b5f8 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 3fdb162e08..33823ce457 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)