CMS 3D CMS Logo

Public Member Functions | Public Attributes

RegexValidator::RegexValidator Class Reference

List of all members.

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.

00004                                                :
00005         self.pattern = re.compile(pattern)
00006         self.statement = statement
00007         if not self.statement:
00008             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.

00010                               :
00011         match = self.pattern.search(string)
00012         if not match:
00013             raise ValueError(self.statement)
00014         return string
00015 

Member Data Documentation

Definition at line 3 of file RegexValidator.py.

Definition at line 3 of file RegexValidator.py.