forked from MarseyWorld/MarseyWorld
hats: fix 2 500s (SQL errors)
parent
60dd29bc6b
commit
a5799b222e
|
@ -101,6 +101,10 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.tv'):
|
||||||
abort(403, f"Only Carp can approve {asset_type}!")
|
abort(403, f"Only Carp can approve {asset_type}!")
|
||||||
name = name.strip()
|
name = name.strip()
|
||||||
if make_lower: name = name.lower()
|
if make_lower: name = name.lower()
|
||||||
|
asset = None
|
||||||
|
if cls == HatDef:
|
||||||
|
asset = g.db.query(cls).filter_by(name=name).one_or_none()
|
||||||
|
else:
|
||||||
asset = g.db.get(cls, name)
|
asset = g.db.get(cls, name)
|
||||||
if not asset:
|
if not asset:
|
||||||
abort(404, f"This {asset} '{name}' doesn't exist!")
|
abort(404, f"This {asset} '{name}' doesn't exist!")
|
||||||
|
@ -171,6 +175,10 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.tv'):
|
||||||
name = name.strip()
|
name = name.strip()
|
||||||
if not name:
|
if not name:
|
||||||
abort(400, f"You need to specify a {type_name}!")
|
abort(400, f"You need to specify a {type_name}!")
|
||||||
|
asset = None
|
||||||
|
if cls == HatDef:
|
||||||
|
asset = g.db.query(cls).filter_by(name=name).one_or_none()
|
||||||
|
else:
|
||||||
asset = g.db.get(cls, name)
|
asset = g.db.get(cls, name)
|
||||||
if not asset:
|
if not asset:
|
||||||
abort(404, f"This {type_name} '{name}' doesn't exist!")
|
abort(404, f"This {type_name} '{name}' doesn't exist!")
|
||||||
|
@ -270,6 +278,7 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.tv'):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
hat.price = int(request.values.get('price'))
|
hat.price = int(request.values.get('price'))
|
||||||
|
if hat.price < 0: raise ValueError("Invalid hat price")
|
||||||
except:
|
except:
|
||||||
abort(400, "Invalid hat price")
|
abort(400, "Invalid hat price")
|
||||||
hat.name = new_name
|
hat.name = new_name
|
||||||
|
|
Loading…
Reference in New Issue