From 3932f79538d5ba4ff30964086ef9bc129091f154 Mon Sep 17 00:00:00 2001 From: tkikuchi <> Date: Fri, 13 May 2005 11:35:38 +0000 Subject: I finally find out why re.escape() doesn't work properly. '%' should not be escaped for it is the insert directive. It was my trial and error in the comments in previous version. Well, I didn't think of '++' ... --- Mailman/Archiver/HyperArch.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Mailman/Archiver') diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index c6a2ff0e..372f2409 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -410,9 +410,10 @@ class Article(pipermail.Article): # This part was taken from CookHeaders.py (TK) prefix = self._mlist.subject_prefix.strip() if prefix: - prefix_pat = re.sub(r'%\d*d', r'\s*\d+\s*', prefix) - prefix_pat = re.sub('([\[\(\{\)])', '\\\\\g<1>', prefix_pat) - subject = re.sub(re.escape(prefix_pat), '', subject) + prefix_pat = re.escape(prefix) + prefix_pat = '%'.join(prefix_pat.split(r'\%')) + prefix_pat = re.sub(r'%\d*d', r'\s*\d+\s*', prefix_pat) + subject = re.sub(prefix_pat, '', subject) subject = subject.lstrip() strip_pat = re.compile('^((RE|AW|SV)(\[\d+\])?:\s*)+', re.I) stripped = strip_pat.sub('', subject) -- cgit v1.2.3