The FancyValidator class is accessible via the formencode.api module.
Validators have two important external methods:
There are five important methods for subclasses to override, however none of these have to be overridden, only the ones that are appropriate for the validator:
Validators should have no internal state besides the values given at instantiation. They should be reusable and reentrant.
All subclasses can take the arguments/instance variables:
Messages
Return a dictionary of all the messages of this validator, and any subvalidators if present. Keys are message names, values may be a message or list of messages. This is really just intended for documentation purposes, to show someone all the messages that a validator or compound validator (like Schemas) can produce.
@@: Should this produce a more structured set of messages, so that messages could be unpacked into a rendered form to see the placement of all the messages? Well, probably so.
Return any validators that this validator contains. This is not useful for functional, except to inspect what values are available. Specifically the .all_messages() method uses this to accumulate all possible messages.
Encode a string in base64, stripping whitespace and removing newlines.
See the source for more information.