fd
This commit is contained in:
parent
0c75d5b7c8
commit
affba6fac0
5 changed files with 9 additions and 42 deletions
|
@ -901,9 +901,6 @@ def save_comment(cid, v):
|
||||||
|
|
||||||
g.db.add(new_save)
|
g.db.add(new_save)
|
||||||
|
|
||||||
try: g.db.flush()
|
|
||||||
except: g.db.rollback()
|
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
return {"message": "Comment saved!"}
|
return {"message": "Comment saved!"}
|
||||||
|
|
|
@ -102,10 +102,7 @@ def error_451(e, v):
|
||||||
@app.errorhandler(500)
|
@app.errorhandler(500)
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def error_500(e, v):
|
def error_500(e, v):
|
||||||
try:
|
g.db.rollback()
|
||||||
g.db.rollback()
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"error": "500 Internal Server Error"}, 500
|
if request.headers.get("Authorization"): return {"error": "500 Internal Server Error"}, 500
|
||||||
else: return render_template('errors/500.html', v=v), 500
|
else: return render_template('errors/500.html', v=v), 500
|
||||||
|
|
|
@ -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()
|
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:
|
for a in otheralts:
|
||||||
try:
|
new_alt = Alt(user1=a.user1, user2=past_id)
|
||||||
new_alt = Alt(user1=a.user1, user2=past_id)
|
g.db.add(new_alt)
|
||||||
g.db.add(new_alt)
|
|
||||||
g.db.flush()
|
|
||||||
except Exception as e:
|
|
||||||
g.db.rollback()
|
|
||||||
continue
|
|
||||||
for a in otheralts:
|
for a in otheralts:
|
||||||
try:
|
new_alt = Alt(user1=a.user1, user2=current_id)
|
||||||
new_alt = Alt(user1=a.user1, user2=current_id)
|
g.db.add(new_alt)
|
||||||
g.db.add(new_alt)
|
|
||||||
g.db.flush()
|
|
||||||
except Exception as e:
|
|
||||||
g.db.rollback()
|
|
||||||
continue
|
|
||||||
for a in otheralts:
|
for a in otheralts:
|
||||||
try:
|
new_alt = Alt(user1=a.user2, user2=past_id)
|
||||||
new_alt = Alt(user1=a.user2, user2=past_id)
|
g.db.add(new_alt)
|
||||||
g.db.add(new_alt)
|
|
||||||
g.db.flush()
|
|
||||||
except Exception as e:
|
|
||||||
g.db.rollback()
|
|
||||||
continue
|
|
||||||
for a in otheralts:
|
for a in otheralts:
|
||||||
try:
|
new_alt = Alt(user1=a.user2, user2=current_id)
|
||||||
new_alt = Alt(user1=a.user2, user2=current_id)
|
g.db.add(new_alt)
|
||||||
g.db.add(new_alt)
|
|
||||||
g.db.flush()
|
|
||||||
except Exception as e:
|
|
||||||
g.db.rollback()
|
|
||||||
continue
|
|
||||||
|
|
||||||
# login post procedure
|
# login post procedure
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,6 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
#check file size
|
#check file size
|
||||||
if request.content_length > 16 * 1024 * 1024:
|
if request.content_length > 16 * 1024 * 1024:
|
||||||
g.db.rollback()
|
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
file = request.files['file']
|
file = request.files['file']
|
||||||
|
@ -514,7 +513,6 @@ def settings_log_out_others(v):
|
||||||
def settings_images_profile(v):
|
def settings_images_profile(v):
|
||||||
|
|
||||||
if request.content_length > 16 * 1024 * 1024:
|
if request.content_length > 16 * 1024 * 1024:
|
||||||
g.db.rollback()
|
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
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
|
@validate_formkey
|
||||||
def settings_images_banner(v):
|
def settings_images_banner(v):
|
||||||
if request.content_length > 16 * 1024 * 1024:
|
if request.content_length > 16 * 1024 * 1024:
|
||||||
g.db.rollback()
|
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
|
||||||
|
|
|
@ -96,8 +96,6 @@ def api_vote_post(post_id, new, v):
|
||||||
)
|
)
|
||||||
g.db.add(vote)
|
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.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()
|
post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
@ -151,8 +149,6 @@ def api_vote_comment(comment_id, new, v):
|
||||||
|
|
||||||
g.db.add(vote)
|
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.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()
|
comment.downvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||||
g.db.add(comment)
|
g.db.add(comment)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue