diff options
-rw-r--r-- | Mailman/Archiver/HyperArch.py | 6 | ||||
-rw-r--r-- | Mailman/Defaults.py.in | 10 | ||||
-rw-r--r-- | Mailman/Handlers/CookHeaders.py | 15 |
3 files changed, 16 insertions, 15 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index 5a37adad..c6a2ff0e 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2003 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -412,7 +412,7 @@ class Article(pipermail.Article): 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(prefix_pat, '', subject) + subject = re.sub(re.escape(prefix_pat), '', subject) subject = subject.lstrip() strip_pat = re.compile('^((RE|AW|SV)(\[\d+\])?:\s*)+', re.I) stripped = strip_pat.sub('', subject) @@ -585,7 +585,7 @@ class Article(pipermail.Article): try: del self.html_body except AttributeError: - pass + pass class HyperArchive(pipermail.T): diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index 5ed516f8..dd73fc4e 100644 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -829,12 +829,14 @@ DEFAULT_MSG_FOOTER = """_______________________________________________ """ # Where to put subject prefix for 'Re:' messages: +# # old style: Re: [prefix] test # new style: [prefix 123] Re: test ... (number is optional) -# Old style is default for backward compatibility. New style is forced if -# a list owner set %d (numbering) in prefix. If the site owner had applied -# new style patch (from SF patch area) before, he/she may want to set this -# No in mm_cfg.py. +# +# Old style is default for backward compatibility. New style is forced if a +# list owner set %d (numbering) in prefix. If the site owner had applied new +# style patch (from SF patch area) before, he/she may want to set this No in +# mm_cfg.py. OLD_STYLE_PREFIXING = Yes # Scrub regular delivery diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index fce88c44..993c0471 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -14,8 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -"""Cook a message's Subject header. -""" +"""Cook a message's Subject header.""" from __future__ import nested_scopes import re @@ -51,7 +50,7 @@ nonascii = re.compile('[^\s!-~]') def uheader(mlist, s, header_name=None, continuation_ws='\t', maxlinelen=None): # Get the charset to encode the string in. Then search if there is any - # non-ascii character is in the string. If there is and the charset is + # non-ascii character is in the string. If there is and the charset is # us-ascii then we use iso-8859-1 instead. If the string is ascii only # we use 'us-ascii' if another charset is specified. charset = Utils.GetCharSet(mlist.preferred_language) @@ -188,7 +187,7 @@ def process(mlist, msg, msgdata): i18ndesc = uheader(mlist, mlist.description, 'List-Id', maxlinelen=998) listid_h = formataddr((str(i18ndesc), listid)) else: - # without desc we need to ensure the MUST brackets + # without desc we need to ensure the MUST brackets listid_h = '<%s>' % listid # We always add a List-ID: header. del msg['list-id'] @@ -236,7 +235,7 @@ def prefix_subject(mlist, msg, msgdata): # tracked (e.g. internally crafted, delivered to a single user such as the # list admin). prefix = mlist.subject_prefix.strip() - if not prefix: + if not prefix: return subject = msg.get('subject', '') # Try to figure out what the continuation_ws is for the header @@ -260,7 +259,7 @@ def prefix_subject(mlist, msg, msgdata): # [],(), or {}, the prefix in the responding post subject will be cared. # sequential number format allows '%05d' like pattern. p = re.compile('%\d*d') - if p.search(prefix,1): + 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) @@ -271,7 +270,7 @@ def prefix_subject(mlist, msg, msgdata): # Convert [ ( { ) --> \\[ \\( \\{ \\) to feed into re module. # TK: Something magic should be here but after trial and error... prefix_pattern = re.sub('([\[\(\{\)])', '\\\\\g<1>', prefix_pattern) - subject = re.sub(prefix_pattern, '', subject) + subject = re.sub(re.escape(prefix_pattern), '', subject) rematch = re.match('((RE|AW|SV)(\[\d+\])?:\s*)+', subject, re.I) if rematch: subject = subject[rematch.end():] |