minor fix/adjustment regarding getCompiledRegex

This commit is contained in:
Miroslav Stampar 2010-05-27 11:52:18 +00:00
parent ce29c841cf
commit c431a74d9e

View File

@ -1277,15 +1277,15 @@ def getGoodSamaritanParameters(part, prevValue, originalCharset):
else: else:
return None, None, originalCharset return None, None, originalCharset
def getCompiledRegex(regex, args=()): def getCompiledRegex(regex, *args):
""" """
Returns compiled regular expression and stores it in cache for further usage Returns compiled regular expression and stores it in cache for further usage
""" """
if regex in __compiledRegularExpressions: if (regex, args) in __compiledRegularExpressions:
return __compiledRegularExpressions[regex] return __compiledRegularExpressions[(regex, args)]
else: else:
retVal = re.compile(regex, *args) retVal = re.compile(regex, *args)
__compiledRegularExpressions[regex] = retVal __compiledRegularExpressions[(regex, args)] = retVal
return retVal return retVal
def getPartRun(): def getPartRun():