aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers
diff options
context:
space:
mode:
authortkikuchi <>2005-05-13 11:35:38 +0000
committertkikuchi <>2005-05-13 11:35:38 +0000
commit3932f79538d5ba4ff30964086ef9bc129091f154 (patch)
tree9dd104173a7f679e57863b1e4d5d0164066de8c3 /Mailman/Handlers
parent264c89eee7d25b5ad439ef1f0304eb47ce9e7d84 (diff)
downloadmailman2-3932f79538d5ba4ff30964086ef9bc129091f154.tar.gz
mailman2-3932f79538d5ba4ff30964086ef9bc129091f154.tar.xz
mailman2-3932f79538d5ba4ff30964086ef9bc129091f154.zip
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 '++' ...
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r--Mailman/Handlers/CookHeaders.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py
index 6b81546e..1db23aec 100644
--- a/Mailman/Handlers/CookHeaders.py
+++ b/Mailman/Handlers/CookHeaders.py
@@ -253,21 +253,21 @@ def prefix_subject(mlist, msg, msgdata):
# subject is mime-encoded and cset is set as us-ascii. See detail
# for ch_oneline() (CookHeaders one line function).
subject, cset = ch_oneline(subject)
- # Note: searching prefix in subject is REMOVED. (seq version)
# If the subject_prefix contains '%d', it is replaced with the
- # mailing list sequential number. Also, if the prefix is closed with
- # [],(), or {}, the prefix in the responding post subject will be cared.
- # sequential number format allows '%05d' like pattern.
+ # mailing list sequential number. Sequential number format allows
+ # '%d' or '%05d' like pattern.
+ prefix_pattern = re.escape(prefix)
+ # unescape '%' :-<
+ prefix_pattern = '%'.join(prefix_pattern.split(r'\%'))
p = re.compile('%\d*d')
if p.search(prefix, 1):
# prefix have number, so we should search prefix w/number in subject.
- # Also, old_style is forced to False
- prefix_pattern = p.sub(r'\s*\d+\s*', prefix)
+ # Also, force new style.
+ prefix_pattern = p.sub(r'\s*\d+\s*', prefix_pattern)
old_style = False
else:
- prefix_pattern = prefix
old_style = mm_cfg.OLD_STYLE_PREFIXING
- subject = re.sub(re.escape(prefix_pattern), '', subject)
+ subject = re.sub(prefix_pattern, '', subject)
rematch = re.match('((RE|AW|SV)(\[\d+\])?:\s*)+', subject, re.I)
if rematch:
subject = subject[rematch.end():]