forked from mrlan/EnglishPal
fix: fix the way to check article level
parent
cabf6702a7
commit
1015704e23
|
@ -62,7 +62,7 @@ def admin():
|
||||||
level = data.get("level", "5")
|
level = data.get("level", "5")
|
||||||
if content:
|
if content:
|
||||||
try: # check level
|
try: # check level
|
||||||
if not (0 < int(level) <= 5):
|
if level not in [str(x + 1) for x in range(5)]:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return "level must be between 1 and 5"
|
return "level must be between 1 and 5"
|
||||||
|
|
Loading…
Reference in New Issue