test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
RegexValidator.RegexValidator Class Reference
Inheritance diagram for RegexValidator.RegexValidator:

Public Member Functions

def __call__
 
def __init__
 

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 
4  def __init__(self, pattern, statement=None):
5  self.pattern = re.compile(pattern)
6  self.statement = statement
7  if not self.statement:
8  self.statement = "must match pattern %s" % self.pattern

Member Function Documentation

def RegexValidator.RegexValidator.__call__ (   self,
  string 
)

Definition at line 9 of file RegexValidator.py.

References RegexValidator.RegexValidator.statement.

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

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__().