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.Options Class Reference
Inheritance diagram for google.appengine.api.validation.Options:
google.appengine.api.validation.Validator

Public Member Functions

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

Public Attributes

 options
 
- 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

Limit field based on pre-determined values.

Options are used to make sure an enumerated set of values are the only
one permitted for assignment.  It is possible to define aliases which
map multiple string values to a single original.  An example of usage:

  class ZooAnimal(validated.Class):
    ATTRIBUTES = {
      'name': str,
      'kind': Options('platypus',                   # No aliases
                      ('rhinoceros', ['rhino']),    # One alias
                      ('canine', ('dog', 'puppy')), # Two aliases
                      )

Constructor & Destructor Documentation

def google.appengine.api.validation.Options.__init__ (   self,
  options,
  kw 
)
Initialize options.

Args:
  options: List of allowed values.

Member Function Documentation

def google.appengine.api.validation.Options.Validate (   self,
  value,
  key 
)
Validate options.

Returns:
  Original value for provided alias.

Raises:
  ValidationError: when value is not one of predefined values.

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