CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RegexValidator.py
Go to the documentation of this file.
1 import re
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 
9  def __call__(self, string):
10  match = self.pattern.search(string)
11  if not match:
12  raise ValueError(self.statement)
13  return string
14 
list object
Definition: dbtoconf.py:77