t.v.Validator(object) : class documentation

Part of twistar.validation View In Hierarchy

Known subclasses: twistar.dbobject.DBObject

A mixin class to handle validating objects before they are saved.
Line # Kind Name Docs
0 Class Variable VALIDATIONS A list of functions to call when testing whether or not a particular instance is valid.
95 Class Method clearValidations Clear the given class's validations.
103 Class Method addValidator Add a function to the given classes validation list.
121 Class Method validatesPresenceOf A validator to test whether or not some named properties are set. For those named properties that are not set, an error will be recorded in obj.errors.
137 Class Method validatesUniquenessOf A validator to test whether or not some named properties are unique. For those named properties that are not unique, an error will be recorded in obj.errors.
153 Class Method validatesLengthOf No summary
175 Class Method _validate Validate a given object using all of the set validators for the objects class. If errors are found, they will be recorded in the objects errors property.
VALIDATIONS =
A list of functions to call when testing whether or not a particular instance is valid.
@classmethod
def clearValidations(klass):
Clear the given class's validations.
@classmethod
def addValidator(klass, func):
Add a function to the given classes validation list.
ParametersklassThe Class to add the validator to.
funcA function that accepts a single parameter that is the object to test for validity. If the object is invalid, then this function should add errors to it's errors property.
See AlsoErrors
@classmethod
def validatesPresenceOf(klass, *names, **kwargs):
A validator to test whether or not some named properties are set. For those named properties that are not set, an error will be recorded in obj.errors.
ParametersklassThe klass whose properties need to be tested.
namesThe names of the properties to test.
kwargsKeyword arguments. Right now, all but a message value are ignored.
@classmethod
def validatesUniquenessOf(klass, *names, **kwargs):
A validator to test whether or not some named properties are unique. For those named properties that are not unique, an error will be recorded in obj.errors.
ParametersklassThe klass whose properties need to be tested.
namesThe names of the properties to test.
kwargsKeyword arguments. Right now, all but a message value are ignored.
@classmethod
def validatesLengthOf(klass, *names, **kwargs):
A validator to test whether or not some named properties have a specific length. The length is specified in one of two ways: either a range keyword set with a range / xrange / list object containing valid values, or a length keyword with the exact length allowed.

For those named properties that do not have the specified length, an error will be recorded in the instance of klass's errors parameter.

ParametersklassThe klass whose properties need to be tested.
namesThe names of the properties to test.
kwargsKeyword arguments. Right now, all but message, range, and length values are ignored.
@classmethod
def _validate(klass, obj):
Validate a given object using all of the set validators for the objects class. If errors are found, they will be recorded in the objects errors property.
ReturnsA Deferred whose callback will receive the given object.
See AlsoErrors
API Documentation for twistar, generated by pydoctor at 2012-06-12 10:00:49.