commit
c541960cf3
|
@ -189,6 +189,8 @@ class SQLStatement(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def sub(cls, regex_, replace, query):
|
def sub(cls, regex_, replace, query):
|
||||||
""" Like re.sub but also compile and cache the regex. """
|
""" Like re.sub but also compile and cache the regex. """
|
||||||
|
if not isinstance(query, str):
|
||||||
|
query = query[0] if isinstance(query, list) and len(query) > 0 else ''
|
||||||
|
|
||||||
cregex = cls.regex_cache.setdefault(
|
cregex = cls.regex_cache.setdefault(
|
||||||
regex_, regex.compile(regex_, regex.UNICODE | regex.VERSION1))
|
regex_, regex.compile(regex_, regex.UNICODE | regex.VERSION1))
|
||||||
|
|
Loading…
Reference in New Issue