![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | __call__ |
def | Validate |
def | ToValue |
Public Attributes | |
default | |
Static Public Attributes | |
expected_type = object | |
Validator base class. Though any callable can be used as a validator, this class encapsulates the case when a specific validator needs to hold a particular state or configuration. To implement Validator sub-class, override the validate method. This class is permitted to change the ultimate value that is set to the attribute if there is a reasonable way to perform the conversion.
def google.appengine.api.validation.Validator.__init__ | ( | self, | |
default = None |
|||
) |
Constructor. Args: default: Default assignment is made during initialization and will not pass through validation.
def google.appengine.api.validation.Validator.__call__ | ( | self, | |
value, | |||
key = '???' |
|||
) |
Main interface to validator is call mechanism.
def google.appengine.api.validation.Validator.ToValue | ( | self, | |
value | |||
) |
Convert 'value' to a simplified collection or basic type. Subclasses of Validator should override this method when the dumped representation of 'value' is not simply <type>(value) (e.g. a regex). Args: value: An object of the same type that was returned from Validate(). Returns: An instance of a builtin type (e.g. int, str, dict, etc). By default it returns 'value' unmodified.
def google.appengine.api.validation.Validator.Validate | ( | self, | |
value, | |||
key = '???' |
|||
) |
Override this method to customize sub-class behavior. Args: value: Value to validate. key: Name of the field being validated. Returns: Value if value is valid, or a valid representation of value.