Operation validator should be called AFTER type validation. #18
When you implement a new data type, e.g., 'number', you'd expect it to be actually checked before the operations get validated. The test shows that currently you have to modify your method "_validate_min_number" and catch the exception raised by calling int(value), like the following:
def _validate_min_number(self, min_value, field, value): """Validates the 'min_number' operation on the 'number' data type.""" try: value = int(value) except ValueError: return super(BaseValidator, self)._validate_min(min_value, field, value)
Otherwise, you`ll get a ValueError, instead of a ValidationError (or whatever).
The text was updated successfully, but these errors were encountered:
Type validation is performed before any other validation rule which might exist on the same field (only exception being the 'nullable' rule). In the occurrence of a type failure, subsequent validation rules on the field will be skipped and validation will continue on other fields. This allows to safely assume that field type is correct when other (standard or custom) rules are invoked. Closes #18.