configtypes: Make none_ok work for IntList.
This commit is contained in:
parent
073504abb4
commit
88416db6a3
@ -317,10 +317,17 @@ class IntList(List):
|
|||||||
typestr = 'int-list'
|
typestr = 'int-list'
|
||||||
|
|
||||||
def transform(self, value):
|
def transform(self, value):
|
||||||
|
if not value:
|
||||||
|
return None
|
||||||
vals = super().transform(value)
|
vals = super().transform(value)
|
||||||
return [int(v) if v is not None else None for v in vals]
|
return [int(v) if v is not None else None for v in vals]
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
|
if not value:
|
||||||
|
if self.none_ok:
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
raise configexc.ValidationError(value, "may not be empty!")
|
||||||
try:
|
try:
|
||||||
vals = self.transform(value)
|
vals = self.transform(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
Loading…
Reference in New Issue
Block a user