diff options
| author | Mark Sapiro | 2015-10-08 13:15:53 -0700 |
|---|---|---|
| committer | Barry Warsaw | 2015-10-29 22:23:30 -0400 |
| commit | aed50db488213b0fec32d82100cf9367fc2f7d9c (patch) | |
| tree | 1c7782ef26480f59f61c0d6d041bea2686f8bb05 /src/mailman/handlers/subject_prefix.py | |
| parent | 7fe776a29281dc42e3274f7cf9cc5300dca61783 (diff) | |
| download | mailman-aed50db488213b0fec32d82100cf9367fc2f7d9c.tar.gz mailman-aed50db488213b0fec32d82100cf9367fc2f7d9c.tar.zst mailman-aed50db488213b0fec32d82100cf9367fc2f7d9c.zip | |
Diffstat (limited to 'src/mailman/handlers/subject_prefix.py')
| -rw-r--r-- | src/mailman/handlers/subject_prefix.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mailman/handlers/subject_prefix.py b/src/mailman/handlers/subject_prefix.py index 1f360e7ce..72409dbd3 100644 --- a/src/mailman/handlers/subject_prefix.py +++ b/src/mailman/handlers/subject_prefix.py @@ -30,7 +30,7 @@ from mailman.interfaces.handler import IHandler from zope.interface import implementer -RE_PATTERN = '((RE|AW|SV|VS)(\[\d+\])?:\s*)+' +RE_PATTERN = '\s*((RE|AW|SV|VS)(\[\d+\])?\s*:\s*)+' ASCII_CHARSETS = (None, 'ascii', 'us-ascii') EMPTYSTRING = '' @@ -43,12 +43,6 @@ def ascii_header(mlist, msgdata, subject, prefix, prefix_pattern, ws): if charset not in ASCII_CHARSETS: return None subject_text = EMPTYSTRING.join(str(subject).splitlines()) - rematch = re.match(RE_PATTERN, subject_text, re.I) - if rematch: - subject_text = subject_text[rematch.end():] - recolon = 'Re: ' - else: - recolon = '' # At this point, the subject may become null if someone posted mail # with "Subject: [subject prefix]". if subject_text.strip() == '': @@ -57,6 +51,12 @@ def ascii_header(mlist, msgdata, subject, prefix, prefix_pattern, ws): else: subject_text = re.sub(prefix_pattern, '', subject_text) msgdata['stripped_subject'] = subject_text + rematch = re.match(RE_PATTERN, subject_text, re.I) + if rematch: + subject_text = subject_text[rematch.end():] + recolon = 'Re: ' + else: + recolon = '' lines = subject_text.splitlines() first_line = [lines[0]] if recolon: @@ -77,12 +77,6 @@ def all_same_charset(mlist, msgdata, subject, prefix, prefix_pattern, ws): if charset != list_charset: return None subject_text = EMPTYSTRING.join(chunks) - rematch = re.match(RE_PATTERN, subject_text, re.I) - if rematch: - subject_text = subject_text[rematch.end():] - recolon = 'Re: ' - else: - recolon = '' # At this point, the subject may become null if someone posted mail # with "Subject: [subject prefix]". if subject_text.strip() == '': @@ -91,6 +85,12 @@ def all_same_charset(mlist, msgdata, subject, prefix, prefix_pattern, ws): else: subject_text = re.sub(prefix_pattern, '', subject_text) msgdata['stripped_subject'] = subject_text + rematch = re.match(RE_PATTERN, subject_text, re.I) + if rematch: + subject_text = subject_text[rematch.end():] + recolon = 'Re: ' + else: + recolon = '' lines = subject_text.splitlines() first_line = [lines[0]] if recolon: |
