build regex pattern correctly. Fixes #5596

This commit is contained in:
Yann Leboulanger 2010-02-11 10:24:39 +01:00
parent 357d7db07d
commit 336102c6f2
1 changed files with 8 additions and 16 deletions

View File

@ -2311,37 +2311,29 @@ class Interface:
@property @property
def basic_pattern_re(self): def basic_pattern_re(self):
try: if not self._basic_pattern_re:
return self._basic_pattern_re
except AttributeError:
self._basic_pattern_re = re.compile(self.basic_pattern, self._basic_pattern_re = re.compile(self.basic_pattern,
re.IGNORECASE) re.IGNORECASE)
return self._basic_pattern_re return self._basic_pattern_re
@property @property
def emot_and_basic_re(self): def emot_and_basic_re(self):
try: if not self._emot_and_basic_re:
return self._emot_and_basic_re
except AttributeError:
self._emot_and_basic_re = re.compile(self.emot_and_basic, self._emot_and_basic_re = re.compile(self.emot_and_basic,
re.IGNORECASE + re.UNICODE) re.IGNORECASE + re.UNICODE)
return self._emot_and_basic_re return self._emot_and_basic_re
@property @property
def sth_at_sth_dot_sth_re(self): def sth_at_sth_dot_sth_re(self):
try: if not self._sth_at_sth_dot_sth_re:
return self._sth_at_sth_dot_sth_re
except AttributeError:
self._sth_at_sth_dot_sth_re = re.compile(self.sth_at_sth_dot_sth) self._sth_at_sth_dot_sth_re = re.compile(self.sth_at_sth_dot_sth)
return self._sth_at_sth_dot_sth_re return self._sth_at_sth_dot_sth_re
@property @property
def invalid_XML_chars_re(self): def invalid_XML_chars_re(self):
try: if not self._invalid_XML_chars_re:
return self._invalid_XML_chars_re
except AttributeError:
self._invalid_XML_chars_re = re.compile(self.invalid_XML_chars) self._invalid_XML_chars_re = re.compile(self.invalid_XML_chars)
return self._invalid_XML_chars_re return self._invalid_XML_chars_re
def make_regexps(self): def make_regexps(self):
# regexp meta characters are: . ^ $ * + ? { } [ ] \ | ( ) # regexp meta characters are: . ^ $ * + ? { } [ ] \ | ( )