![]() |
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 | Validate |
def | ToValue |
![]() | |
def | __init__ |
def | __call__ |
def | Validate |
def | ToValue |
Public Attributes | |
validator | |
expected_type | |
default | |
![]() | |
default | |
Additional Inherited Members | |
![]() | |
expected_type = object | |
Definition of optional attributes. Optional values are attributes which can be set to None or left unset. All values in a basic Validated class are set to None at initialization. Failure to assign to non-optional values will result in a validation error when calling CheckInitialized.
def google.appengine.api.validation.Optional.__init__ | ( | self, | |
validator, | |||
default = None |
|||
) |
Initializer. This constructor will make a few guesses about the value passed in as the validator: - If the validator argument is a type, it automatically creates a Type validator around it. - If the validator argument is a list or tuple, it automatically creates an Options validator around it. Args: validator: Optional validation condition. Raises: AttributeDefinitionError: if validator is not callable.
def google.appengine.api.validation.Optional.ToValue | ( | self, | |
value | |||
) |
Convert 'value' to a simplified collection or basic type.
def google.appengine.api.validation.Optional.Validate | ( | self, | |
value, | |||
key | |||
) |
Optionally require a value. Normal validators do not accept None. This will accept none on behalf of the contained validator. Args: value: Value to be validated as optional. key: Name of the field being validated. Returns: None if value is None, else results of contained validation.