Permalink
Browse files

fixed a bug where all the data would not be checked.

  • Loading branch information...
1 parent 400fa00 commit 7a3c861b8c34c130d26bc88640fd460c2be2c314 Christophe Eymard committed Aug 8, 2012
Showing with 4 additions and 8 deletions.
  1. +1 −1 validictory/__init__.py
  2. +3 −7 validictory/validator.py
View
@@ -3,7 +3,7 @@
from validictory.validator import SchemaValidator, ValidationError, SchemaError
__all__ = ['validate', 'SchemaValidator', 'ValidationError', 'SchemaError']
-__version__ = '0.9.5-homeloc'
+__version__ = '0.9.6-homeloc'
def validate(data, schema, validator_cls=SchemaValidator,
View
@@ -274,18 +274,14 @@ def validate_items(self, x, fieldname, schema, items=None):
return
else:
for itemIndex in range(len(items)):
- # self.push_error_stack()
self.__validate(itemIndex, value, items[itemIndex])
- return
elif isinstance(items, dict):
for i, eachItem in enumerate(value):
self.push_error_stack()
self.__validate(i, value, items)
errs = self.pop_error_stack()
- if len(errs) > 1:
- for e in errs:
- self.error_list.append(e)
- return
+ if errs:
+ self.error_list += errs
else:
raise SchemaError("Properties definition of field '%s' is "
"not a list or an object" % fieldname)
@@ -615,7 +611,7 @@ def __validate(self, fieldname, data, schema):
if errs:
# do not keep validating an object if its type was not correct !
self.error_list += errs
- return
+ return data
for schemaprop in newschema:
validatorname = "validate_" + schemaprop

0 comments on commit 7a3c861

Please sign in to comment.