exception valedictory.exceptions.BaseValidationException[source]

All validation exceptions will be subclasses of this exception.

exception valedictory.exceptions.InvalidDataException(errors={})[source]

Lists of validation errors for each field in a validator.

Only filled out for a field if the field has an error.


A dict with the validation exceptions for all fields that failed validation. Normal field errors will be a ValidationException instance, while errors for ListField and NestedValidator may also be InvalidDataException instances.


Yield a pair of (path, errors) for each error.

>>> list(errors.flatten())
    (['bar'], ['Unknown field']),
    (['foo'], ['This field can not be empty']),

If an error is a InvalidDataException, then errors are recursively extracted. path will be an array of the path to the error. errors will be an array of the error messages from these errors.

If validator was constructed for a shopping cart, which had user details and a list of items in a shopping cart, made using a NestedValidator inside a ListField, some possible flattened errors might be:

>>> list(errors.flatten())
    (['name'], ['This field can not be empty']),
    (['items', 2, 'quantity'], ['This must be equal to or greater than the minimum of 1']),
exception valedictory.exceptions.ValidationException(message, code, **kwargs)[source]

A field has failed validation.


The validation error as a human readable string. This error is translatable via gettext, and should not be used for checking the type of error


The validation error code as a string. This can be used to check the type of error

exception valedictory.exceptions.NoData[source]

Used to indicate that this field had no data supplied. This is different from having empty data, which is represented by None. This bypasses the bit where data is set in the output dict, so the output dict will not have the associated key.