Home | Trees | Indices | Help |
---|
|
object --+ | BaseValidator
A base class for custom validators.
The aim to make construction of new validators easy and quick. Ideally, with this as a base class, most subclasses should only need to override one method (convert_value or validate_value) and perhaps supply a c'tor if some state needs to be stored.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
Inherited from |
|
Converts and validates user input. This converts the passed value (via convert) and then validates it (via validate). It should throw an error if any problems. This is the primary entry-point for validator objects and could be overridden in a subclass if required. However, it would probably be easier done in other methods called by this.
|
Transform a value to the desired form. This attempts to convert the passed value (via convert_value) and if successful returns the new value. If any exception is thrown by conversion, raise_conversion_error is called with the bad value and error (if any). Behaviour could be customised by overriding this in a subclass, but convert_value may be a better target.
|
Transform a value to the desired form. This is the workhorse method that is called by convert to transform passed values. As such, errors are signalled by throwing a meaningful exception. This is one of the obvious and easiest places to customize behaviour by overriding in a subclass.
|
Raise an error for a conversion problem. Override in subclass if need be, for specific exception types and messages.
|
Generate an error message for a conversion problem. Parameters as per raise_conversion_error. Override in subclass if need be, for more specific and meaningful messages. |
Is this value correct or of the correct form? This checks the passed value (via validate_value) and if successful returns the new value. If any exception is thrown by validation, raise_validation_error is called with the bad value and error (if any). Behaviour could be customised by overriding this in a subclass, but validate_value may be a better target.
|
Check a value is of the desired form. This is the workhorse method that is called by validate to check passed values. As such, errors are signalled by either by throwing a meaningful exception or by returning false. This is one of the obvious and easiest places to customize behaviour by overriding in a subclass.
|
Generate an error message for a validation problem. Override in subclass if need be, for specific exception types and messages.
|
Generate an error message for a validation problem. Parameters as per raise_validation_error. Override in subclass if need be, for more specific and meaningful messages. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Jul 22 15:13:46 2011 | http://epydoc.sourceforge.net |