TO GUARD THE ENTRANCE. EVERYBODY, SOONER OR LATER, HAD TO GO THERE, AND NOBODY WANTED TO CARRY OFF THE ENTRANCE. Ambrose Bierce The Devil’s Dictionary CERBERUS, THE NAME
'quotes': {'type':['string','list']}} >>> v.validate({'quotes': 'Hello world!'}) True >>> v.validate({'quotes': ... ['Do not disturb my circles!', 'Heureka!']}) True IF A LIST, ALL LISTED TYPES ARE ALLOWED
▸ nullable ▸ forbidden ▸ readonly ▸ empty (wether a string can be empty) ▸ min, max (arbitrary types) ▸ minlength, maxlength (iterable) ▸ valueschema (validation schema for all values of a dict/mapping) ▸ keyschema (validates the keys of a dict/mapping) ▸ and (a lot) more.
error): ... if not value & 1: ... error(field, "Must be an odd number") >>> schema = {'amount': {'validator': oddity}} >>> v = Validator(schema) >>> v.validate({'amount': 10}) False >>> v.errors {'amount': 'Must be an odd number'} >>> v.validate({'amount': 9}) True
validates any mapping against a validation-schema. ▸ ErrorHandlers. BaseErrorHandler is the base class for all error handlers. Subclasses are identified as error-handlers with an instance-test. ▸ ValidationError. A simple class to store and query basic error information. ▸ ErrorList. A list for ValidationError instances that can be queried with the in keyword for a particular error code. ▸ ErrorTree. Base class for DocumentErrorTree and SchemaErrorTree. ▸ validator_factory. Dynamically create a Validator subclass.