actually return an error instead

master
Aevann 2024-01-20 09:02:08 +02:00
parent f4066a57ac
commit 16abd74031
1 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,9 @@ def hats(v):
hats = hats.filter(HatDef.submitter_id == None)
if sort and sort != "owners":
if sort == "description":
if sort == "name":
key = HatDef.name
elif sort == "description":
key = HatDef.description
elif sort == "author":
key = User.username
@ -35,7 +37,7 @@ def hats(v):
elif sort == "added_on":
key = HatDef.created_utc.desc()
else:
key = HatDef.name
abort(400, "Invalid sort")
hats = hats.order_by(key).offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE).all()
elif sort == "owners":