summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-29 17:16:10 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-29 17:16:10 (GMT)
commit056cb93e7accc6cd21d7bec9d25a8d36b16dbb4a (patch)
treefd95816c3949b3fb737d0cb8f824850063e2027b /Lib
parent1cec3e367c4cdead47eff7ec1f3d65c342daf92f (diff)
downloadcpython-056cb93e7accc6cd21d7bec9d25a8d36b16dbb4a.zip
cpython-056cb93e7accc6cd21d7bec9d25a8d36b16dbb4a.tar.gz
cpython-056cb93e7accc6cd21d7bec9d25a8d36b16dbb4a.tar.bz2
#6630: allow customizing flags for compiling string.Template.idpattern.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/string.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/string.py b/Lib/string.py
index 5089193..defe894 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -81,7 +81,7 @@ class _TemplateMetaclass(type):
'delim' : _re.escape(cls.delimiter),
'id' : cls.idpattern,
}
- cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE)
+ cls.pattern = _re.compile(pattern, cls.flags | _re.VERBOSE)
class Template(metaclass=_TemplateMetaclass):
@@ -89,6 +89,7 @@ class Template(metaclass=_TemplateMetaclass):
delimiter = '$'
idpattern = r'[_a-z][_a-z0-9]*'
+ flags = _re.IGNORECASE
def __init__(self, template):
self.template = template