remotes/1693045480750635534/spooky-22
Aevann1 2021-09-16 19:23:30 +02:00
parent 9fe06dc7fc
commit 329e5939a7
5 changed files with 9 additions and 42 deletions

View File

@ -901,9 +901,6 @@ def save_comment(cid, v):
g.db.add(new_save)
try: g.db.flush()
except: g.db.rollback()
g.db.commit()
return {"message": "Comment saved!"}

View File

@ -102,10 +102,7 @@ def error_451(e, v):
@app.errorhandler(500)
@auth_desired
def error_500(e, v):
try:
g.db.rollback()
except AttributeError:
pass
g.db.rollback()
if request.headers.get("Authorization"): return {"error": "500 Internal Server Error"}, 500
else: return render_template('errors/500.html', v=v), 500

View File

@ -47,37 +47,17 @@ def check_for_alts(current_id):
otheralts = g.db.query(Alt).filter(or_(Alt.user1 == past_id, Alt.user2 == past_id, Alt.user1 == current_id, Alt.user2 == current_id)).all()
for a in otheralts:
try:
new_alt = Alt(user1=a.user1, user2=past_id)
g.db.add(new_alt)
g.db.flush()
except Exception as e:
g.db.rollback()
continue
new_alt = Alt(user1=a.user1, user2=past_id)
g.db.add(new_alt)
for a in otheralts:
try:
new_alt = Alt(user1=a.user1, user2=current_id)
g.db.add(new_alt)
g.db.flush()
except Exception as e:
g.db.rollback()
continue
new_alt = Alt(user1=a.user1, user2=current_id)
g.db.add(new_alt)
for a in otheralts:
try:
new_alt = Alt(user1=a.user2, user2=past_id)
g.db.add(new_alt)
g.db.flush()
except Exception as e:
g.db.rollback()
continue
new_alt = Alt(user1=a.user2, user2=past_id)
g.db.add(new_alt)
for a in otheralts:
try:
new_alt = Alt(user1=a.user2, user2=current_id)
g.db.add(new_alt)
g.db.flush()
except Exception as e:
g.db.rollback()
continue
new_alt = Alt(user1=a.user2, user2=current_id)
g.db.add(new_alt)
# login post procedure

View File

@ -111,7 +111,6 @@ def settings_profile_post(v):
#check file size
if request.content_length > 16 * 1024 * 1024:
g.db.rollback()
abort(413)
file = request.files['file']
@ -514,7 +513,6 @@ def settings_log_out_others(v):
def settings_images_profile(v):
if request.content_length > 16 * 1024 * 1024:
g.db.rollback()
abort(413)
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
@ -542,7 +540,6 @@ def settings_images_profile(v):
@validate_formkey
def settings_images_banner(v):
if request.content_length > 16 * 1024 * 1024:
g.db.rollback()
abort(413)
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403

View File

@ -96,8 +96,6 @@ def api_vote_post(post_id, new, v):
)
g.db.add(vote)
try: g.db.flush()
except: g.db.rollback()
post.upvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=1).count()
post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count()
g.db.add(post)
@ -151,8 +149,6 @@ def api_vote_comment(comment_id, new, v):
g.db.add(vote)
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)