forked from rDrama/rDrama
use abort for cocnsistency
parent
5d68d55515
commit
e9edd9f89a
|
@ -473,14 +473,14 @@ def badge_grant_post(v):
|
||||||
usernames = request.values.get("usernames", "").strip()
|
usernames = request.values.get("usernames", "").strip()
|
||||||
if not usernames:
|
if not usernames:
|
||||||
error = "You must enter usernames!"
|
error = "You must enter usernames!"
|
||||||
if v.client: return {"error": error}
|
if v.client: abort(400, error)
|
||||||
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error=error)
|
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error=error)
|
||||||
|
|
||||||
for username in usernames.split():
|
for username in usernames.split():
|
||||||
user = get_user(username, graceful=True)
|
user = get_user(username, graceful=True)
|
||||||
if not user:
|
if not user:
|
||||||
error = "User not found!"
|
error = "User not found!"
|
||||||
if v.client: return {"error": error}
|
if v.client: abort(400, error)
|
||||||
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error=error)
|
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error=error)
|
||||||
|
|
||||||
try: badge_id = int(request.values.get("badge_id"))
|
try: badge_id = int(request.values.get("badge_id"))
|
||||||
|
@ -550,7 +550,7 @@ def badge_remove_post(v):
|
||||||
usernames = request.values.get("usernames", "").strip()
|
usernames = request.values.get("usernames", "").strip()
|
||||||
if not usernames:
|
if not usernames:
|
||||||
error = "You must enter usernames!"
|
error = "You must enter usernames!"
|
||||||
if v.client: return {"error": error}
|
if v.client: abort(400, error)
|
||||||
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error=error)
|
return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error=error)
|
||||||
|
|
||||||
for username in usernames.split():
|
for username in usernames.split():
|
||||||
|
|
Loading…
Reference in New Issue