IS_LIST_OF(other=[..])

This commit is contained in:
mdipierro committed 2014-01-08 13:43:49 -06:00
1 parent 6bbafc5920
commit 4192405444
2 files changed
+10 -6

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 2.8.2-stable+timestamp.2014.01.08.11.31.12 Version 2.8.2-stable+timestamp.2014.01.08.13.42.47
+9 -5
View File
@@ -2462,14 +2462,18 @@ class IS_LIST_OF(Validator):
if not self.maximum is None and len(ivalue) > self.maximum: if not self.maximum is None and len(ivalue) > self.maximum:
return (ivalue, translate(self.error_message) % dict(min=self.minimum, max=self.maximum)) return (ivalue, translate(self.error_message) % dict(min=self.minimum, max=self.maximum))
new_value = [] new_value = []
other = self.other
if self.other: if self.other:
if not isinstance(other, (list,tuple)):
other = [other]
for item in ivalue: for item in ivalue:
if item.strip(): if item.strip():
(v, e) = self.other(item) v = item
if e: for validator in other:
return (ivalue, e) (v, e) = validator(v)
else: if e:
new_value.append(v) return (ivalue, e)
new_value.append(v)
ivalue = new_value ivalue = new_value
return (ivalue, None) return (ivalue, None)