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

 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 a string can compile as a regex without errors.

Use this validator when the value of a field should be a regex.  That
means that the value must be a string that can be compiled by re.compile().
The attribute will then be a compiled re object.

Constructor & Destructor Documentation

def google.appengine.api.validation.RegexStr.__init__ (   self,
  string_type = unicode,
  default = None 
)
Initialized regex validator.

Raises:
  AttributeDefinitionError: if string_type is not a kind of string.

Member Function Documentation

def google.appengine.api.validation.RegexStr.ToValue (   self,
  value 
)
Returns the RE pattern for this validator.
def google.appengine.api.validation.RegexStr.Validate (   self,
  value,
  key 
)
Validates that the string compiles as a regular expression.

Because the regular expression might have been expressed as a multiline
string, this function also strips newlines out of value.

Args:
  value: String to compile as a regular expression.
  key: Name of the field being validated.

Raises:
  ValueError when value does not compile as a regular expression.  TypeError
  when value does not match provided string type.

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