CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
RegexValidator.RegexValidator Class Reference
Inheritance diagram for RegexValidator.RegexValidator:

Public Member Functions

def __call__ (self, string)
 
def __init__ (self, pattern, statement=None)
 

Public Attributes

 pattern
 
 statement
 

Detailed Description

Definition at line 2 of file RegexValidator.py.

Constructor & Destructor Documentation

def RegexValidator.RegexValidator.__init__ (   self,
  pattern,
  statement = None 
)

Definition at line 3 of file RegexValidator.py.

3  def __init__(self, pattern, statement=None):
4  self.pattern = re.compile(pattern)
5  self.statement = statement
6  if not self.statement:
7  self.statement = "must match pattern %s" % self.pattern
8 
def __init__(self, pattern, statement=None)

Member Function Documentation

def RegexValidator.RegexValidator.__call__ (   self,
  string 
)

Definition at line 9 of file RegexValidator.py.

References RegexValidator.RegexValidator.statement.

9  def __call__(self, string):
10  match = self.pattern.search(string)
11  if not match:
12  raise ValueError(self.statement)
13  return string
14 

Member Data Documentation

RegexValidator.RegexValidator.pattern

Definition at line 4 of file RegexValidator.py.

RegexValidator.RegexValidator.statement

Definition at line 5 of file RegexValidator.py.

Referenced by RegexValidator.RegexValidator.__call__().