support '0' as an IntSetting value
This commit is contained in:
parent
621fb0b396
commit
f9d13dc373
1 changed files with 6 additions and 3 deletions
|
@ -298,9 +298,12 @@ class BoolSetting(Setting):
|
|||
class IntSetting(Setting):
|
||||
example = "10"
|
||||
def parse(self, value: str) -> typing.Any:
|
||||
stripped = value.lstrip("0")
|
||||
if stripped.isdigit():
|
||||
return int(stripped)
|
||||
if value == "0":
|
||||
return 0
|
||||
else:
|
||||
stripped = value.lstrip("0")
|
||||
if stripped.isdigit():
|
||||
return int(stripped)
|
||||
return None
|
||||
|
||||
class IntRangeSetting(IntSetting):
|
||||
|
|
Loading…
Reference in a new issue