App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Public Attributes | List of all members
google.appengine.api.validation.Optional Class Reference
Inheritance diagram for google.appengine.api.validation.Optional:
google.appengine.api.validation.Validator

Public Member Functions

def __init__
 
def Validate
 
def ToValue
 
- Public Member Functions inherited from google.appengine.api.validation.Validator
def __init__
 
def __call__
 
def Validate
 
def ToValue
 

Public Attributes

 validator
 
 expected_type
 
 default
 
- Public Attributes inherited from google.appengine.api.validation.Validator
 default
 

Additional Inherited Members

- Static Public Attributes inherited from google.appengine.api.validation.Validator
 expected_type = object
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

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.

The documentation for this class was generated from the following file: