gavo.formal.validation module

class gavo.formal.validation.CallableValidator(callable)[source]

Bases: object

A validator that delegates the validation of non-None values to a callable with the same signature as IValidator.validate.

validate(field, value)[source]
exception gavo.formal.validation.FieldError(message, fieldName=None)[source]

Bases: FormsError

Base class for field-related exceptions. The failure message and the failing field name are stored as attributes.

exception gavo.formal.validation.FieldRequiredError(message, fieldName=None)[source]

Bases: FieldValidationError

Exception that signals that a field that is marked as required was not entered.

exception gavo.formal.validation.FieldValidationError(message, fieldName=None)[source]

Bases: FieldError

Exception that signals that a field failed to validate.

exception gavo.formal.validation.FormError(message)[source]

Bases: FormsError

Form validation error. Raise this, typically from a submit callback, to signal that the form (not an individual field) failed to validate.

class gavo.formal.validation.LengthValidator(min=None, max=None)[source]

Bases: object

Validate the length of the value is within a given range.

validate(field, value)[source]
validationErrorMessage(field)[source]
class gavo.formal.validation.PatternValidator(regex)[source]

Bases: object

Validate the value is a certain pattern.

The required pattern is defined as a regular expression. The regex will be compiled automatically if necessary.

validate(field, value)[source]
class gavo.formal.validation.RangeValidator(min=None, max=None)[source]

Bases: object

Validate the size of the value is within is given range.

validate(field, value)[source]
validationErrorMessage(field)[source]
class gavo.formal.validation.RequiredValidator[source]

Bases: object

validate(field, value)[source]