diff options
author | tkikuchi <> | 2005-01-22 06:55:29 +0000 |
---|---|---|
committer | tkikuchi <> | 2005-01-22 06:55:29 +0000 |
commit | 86cf0b3c4c231d9cd7ec56b1e8274cccaf45c418 (patch) | |
tree | c585d18205c0a2192ab7e9c7327ed5f2c48fc809 | |
parent | 4ce659dbfb43724e8b794df0878639fdd6e1a2d9 (diff) | |
download | mailman2-86cf0b3c4c231d9cd7ec56b1e8274cccaf45c418.tar.gz mailman2-86cf0b3c4c231d9cd7ec56b1e8274cccaf45c418.tar.xz mailman2-86cf0b3c4c231d9cd7ec56b1e8274cccaf45c418.zip |
Introduce old_style in CookHeaders.py and OLD_STYLE_PREFIXING in Defaults.py.
Now the default behavior of prefixing is "Re: [prefix] subject".
Variations like "Re[2]:" and German style "AW:" is now replaced by "Re:".
-rw-r--r-- | Mailman/Defaults.py.in | 10 | ||||
-rw-r--r-- | Mailman/Handlers/CookHeaders.py | 34 | ||||
-rw-r--r-- | NEWS | 5 |
3 files changed, 43 insertions, 6 deletions
diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index ca1fcd65..f4493dca 100644 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -820,6 +820,7 @@ DEFAULT_MAX_MESSAGE_SIZE = 40 # KB # These format strings will be expanded w.r.t. the dictionary for the # mailing list instance. DEFAULT_SUBJECT_PREFIX = "[%(real_name)s] " +# DEFAULT_SUBJECT_PREFIX = "[%(real_name)s %%d]" # for numbering DEFAULT_MSG_HEADER = "" DEFAULT_MSG_FOOTER = """_______________________________________________ %(real_name)s mailing list @@ -827,6 +828,15 @@ DEFAULT_MSG_FOOTER = """_______________________________________________ %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s """ +# 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_PREFIXING = Yes + # Scrub regular delivery DEFAULT_SCRUB_NONDIGEST = False diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index c49c3175..aafe02fe 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -35,6 +35,13 @@ CONTINUATION = ',\n\t' COMMASPACE = ', ' MAXLINELEN = 78 +# True/False +try: + True, False +except NameError: + True = 1 + False = 0 + def _isunicode(s): @@ -251,14 +258,23 @@ def prefix_subject(mlist, msg, msgdata): # sequential number format allows '%05d' like pattern. p = re.compile('%\d*d') if p.search(prefix,1): - # prefix have number, so we should search prefix w/number - # in subject. + # 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) + old_style = False else: prefix_pattern = prefix + old_style = mm_cfg.OLD_STYLE_PREFIXING + # 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.compile('(RE:\s*)+', re.I).sub('Re: ', subject, 1) + rematch = re.match('((RE|AW)(\[\d+\])?:\s*)+', subject, re.I) + if rematch: + subject = subject[rematch.end():] + recolon = 'Re:' + else: + recolon = '' # At this point, subject may become null if someone post mail with # subject: [subject prefix] if subject.strip() == '': @@ -273,7 +289,10 @@ def prefix_subject(mlist, msg, msgdata): # is some weirdness in Header module (TK) if cset == 'us-ascii': try: - h = prefix + ' ' + subject + if old_style: + h = ' '.join([recolon, prefix, subject]) + else: + h = ' '.join([prefix, recolon, subject]) if type(h) == UnicodeType: h = h.encode('us-ascii') else: @@ -284,7 +303,12 @@ def prefix_subject(mlist, msg, msgdata): except UnicodeError: pass # Get the header as a Header instance, with proper unicode conversion - h = uheader(mlist, prefix, 'Subject', continuation_ws=ws) + if old_style: + h = uheader(mlist, recolon, 'Subject', continuation_ws=ws) + h.append(prefix) + else: + h = uheader(mlist, prefix, 'Subject', continuation_ws=ws) + h.append(recolon) # in seq version, subject header is already concatnated if not _isunicode(subject): try: @@ -53,7 +53,10 @@ Here is a history of user visible changes to Mailman. - New feature: subject_prefix can be configured to include a sequence number which is taken from the post_id variable. Also, the prefix is always put at the start of the subject, i.e. "[list-name] Re: original - subject" + subject", if mm_cfg.OLD_STYLE_PREFIXING is set No. The default style + is "Re: [list-name]" if numbering is not set, for backward compatibility. + If the list owner is using numbering feature by "%d" directive, the new + style, "[list-name 123] Re:", is always used. - List owners can now use Scrubber to get the attachments scrubbed (held in the web archive), if the site admin permits it in mm_cfg.py. New |