From e9edd9f89aaa8c8752264144637aef283923a275 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 11 Aug 2023 19:57:41 +0300 Subject: [PATCH] use abort for cocnsistency --- files/routes/admin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index eed10d90d..8c401adf3 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -473,14 +473,14 @@ def badge_grant_post(v): usernames = request.values.get("usernames", "").strip() if not 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) for username in usernames.split(): user = get_user(username, graceful=True) if not user: 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) try: badge_id = int(request.values.get("badge_id")) @@ -550,7 +550,7 @@ def badge_remove_post(v): usernames = request.values.get("usernames", "").strip() if not 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) for username in usernames.split():