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

 minimum
 
 maximum
 
 expected_type
 
- 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

Validates that numbers fall within the correct range.

In theory this class can be emulated using Options, however error
messages generated from that class will not be very intelligible.
This class essentially does the same thing, but knows the intended
integer range.

Also, this range class supports floats and other types that implement
ordinality.

The range is inclusive, meaning 3 is considered in the range
in Range(1,3).

Constructor & Destructor Documentation

def google.appengine.api.validation.Range.__init__ (   self,
  minimum,
  maximum,
  range_type = int,
  default = None 
)
Initializer for range.

At least one of minimum and maximum must be supplied.

Args:
  minimum: Minimum for attribute.
  maximum: Maximum for attribute.
  range_type: Type of field.  Defaults to int.

Raises:
  AttributeDefinitionError: if the specified parameters are incorrect.

Member Function Documentation

def google.appengine.api.validation.Range.Validate (   self,
  value,
  key 
)
Validate that value is within range.

Validates against range-type then checks the range.

Args:
  value: Value to validate.
  key: Name of the field being validated.

Raises:
  ValidationError: when value is out of range.  ValidationError when value
  is not of the same range type.

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