remove now-unnecessary lines relating to int vals

pull/195/head
Aevann 2023-08-20 19:03:34 +03:00
parent f482e7eead
commit 8097c16b55
7 changed files with 2 additions and 47 deletions

View File

@ -161,9 +161,6 @@ def distribute(v, kind, option_id):
autojanny = get_account(AUTOJANNY_ID)
if autojanny.coins == 0: abort(400, "@AutoJanny has 0 coins")
try: option_id = int(option_id)
except: abort(400)
if kind == 'post': cls = PostOption
else: cls = CommentOption

View File

@ -76,9 +76,6 @@ def hats(v):
@limiter.limit('100/minute;1000/3 days', deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def buy_hat(v, hat_id):
try: hat_id = int(hat_id)
except: abort(404, "Hat not found!")
hat = g.db.query(HatDef).filter_by(submitter_id=None, id=hat_id).one_or_none()
if not hat: abort(404, "Hat not found!")
@ -123,9 +120,6 @@ def buy_hat(v, hat_id):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def equip_hat(v, hat_id):
try: hat_id = int(hat_id)
except: abort(404, "Hat not found!")
hat = g.db.query(Hat).filter_by(hat_id=hat_id, user_id=v.id).one_or_none()
if not hat: abort(403, "You don't own this hat!")
@ -141,9 +135,6 @@ def equip_hat(v, hat_id):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def unequip_hat(v, hat_id):
try: hat_id = int(hat_id)
except: abort(404, "Hat not found!")
hat = g.db.query(Hat).filter_by(hat_id=hat_id, user_id=v.id).one_or_none()
if not hat: abort(403, "You don't own this hat!")
@ -157,9 +148,6 @@ def unequip_hat(v, hat_id):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def hat_owners(v, hat_id):
try: hat_id = int(hat_id)
except: abort(404, "Hat not found!")
page = get_page()
users = g.db.query(User, Hat.created_utc).join(Hat.owners).filter(Hat.hat_id == hat_id)

View File

@ -199,14 +199,12 @@ def post_id(pid, v, anything=None, sub=None):
return result
@app.get("/view_more/<int:pid>/<sort>/<offset>")
@app.get("/view_more/<int:pid>/<sort>/<int:offset>")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@auth_desired_with_logingate
def view_more(v, pid, sort, offset):
p = get_post(pid, v=v)
try:
offset = int(offset)
except: abort(400)
try: ids = set(int(x) for x in request.values.get("ids").split(','))
except: abort(400)
@ -256,9 +254,6 @@ def view_more(v, pid, sort, offset):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@auth_desired_with_logingate
def more_comments(v, cid):
try: cid = int(cid)
except: abort(404)
tcid = g.db.query(Comment.top_comment_id).filter_by(id=cid).one_or_none()[0]
if v:

View File

@ -113,10 +113,6 @@ def report_comment(cid, v):
@limiter.limit("100/minute;300/hour;2000/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@admin_level_required(PERMS['REPORTS_REMOVE'])
def remove_report_post(v, pid, uid):
try:
pid = int(pid)
uid = int(uid)
except: abort(404)
report = g.db.query(Report).filter_by(post_id=pid, user_id=uid).one_or_none()
if report:
@ -139,10 +135,6 @@ def remove_report_post(v, pid, uid):
@limiter.limit("100/minute;300/hour;2000/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@admin_level_required(PERMS['REPORTS_REMOVE'])
def remove_report_comment(v, cid, uid):
try:
cid = int(cid)
uid = int(uid)
except: abort(404)
report = g.db.query(CommentReport).filter_by(comment_id=cid, user_id=uid).one_or_none()
if report:

View File

@ -212,9 +212,6 @@ def log(v):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def log_item(id, v):
try: id = int(id)
except: abort(404)
action=g.db.get(ModAction, id)
if not action: abort(404)
@ -374,9 +371,6 @@ def dismiss_mobile_tip():
@auth_required
def transfers_id(id, v):
try: id = int(id)
except: abort(404)
transfer = g.db.get(Comment, id)
if not transfer: abort(404)

View File

@ -892,8 +892,6 @@ def hole_log_item(id, v, sub):
sub = get_sub_by_name(sub)
if not User.can_see(v, sub):
abort(403)
try: id = int(id)
except: abort(404)
action=g.db.get(SubAction, id)

View File

@ -520,9 +520,6 @@ def leaderboard(v):
@app.get("/<int:id>/css")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
def get_css(id):
try: id = int(id)
except: abort(404)
css, bg = g.db.query(User.css, User.background).filter_by(id=id).one_or_none()
if bg:
@ -544,9 +541,6 @@ def get_css(id):
@app.get("/<int:id>/profilecss")
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
def get_profilecss(id):
try: id = int(id)
except: abort(404)
css, bg = g.db.query(User.profilecss, User.profile_background).filter_by(id=id).one_or_none()
if bg:
@ -1383,9 +1377,6 @@ def toggle_pins(sub, sort):
@auth_required
def bid_list(v, bid):
try: bid = int(bid)
except: abort(400)
page = get_page()
users = g.db.query(User, Badge.created_utc).join(User.badges).filter(Badge.badge_id==bid)