IS_LIST_OF(other=[..])

This commit is contained in:
mdipierro
2014-01-08 13:43:49 -06:00
parent 6bbafc5920
commit 4192405444
2 changed files with 10 additions and 6 deletions
+9 -5
View File
@@ -2462,14 +2462,18 @@ class IS_LIST_OF(Validator):
if not self.maximum is None and len(ivalue) > self.maximum:
return (ivalue, translate(self.error_message) % dict(min=self.minimum, max=self.maximum))
new_value = []
other = self.other
if self.other:
if not isinstance(other, (list,tuple)):
other = [other]
for item in ivalue:
if item.strip():
(v, e) = self.other(item)
if e:
return (ivalue, e)
else:
new_value.append(v)
v = item
for validator in other:
(v, e) = validator(v)
if e:
return (ivalue, e)
new_value.append(v)
ivalue = new_value
return (ivalue, None)