diff Lib/string.py @ 63295:91cbb55e20be

#6630: allow customizing flags for compiling string.Template.idpattern.
author Georg Brandl <georg@python.org>
date Thu, 29 Jul 2010 17:16:10 +0000
parents 2006a2f4812d
children b306105bf83d
line wrap: on
line diff
--- a/Lib/string.py	Thu Jul 29 16:26:56 2010 +0000
+++ b/Lib/string.py	Thu Jul 29 17:16:10 2010 +0000
@@ -81,7 +81,7 @@
                 '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 @@
 
     delimiter = '$'
     idpattern = r'[_a-z][_a-z0-9]*'
+    flags = _re.IGNORECASE
 
     def __init__(self, template):
         self.template = template