diff options
author | bwarsaw <> | 2003-04-19 04:57:44 +0000 |
---|---|---|
committer | bwarsaw <> | 2003-04-19 04:57:44 +0000 |
commit | 1a07013f3b027ea660ad9d6d4d551dd1c92adb6f (patch) | |
tree | a2db8059ccd908d7a338a6a613a4cd4107db097c /Mailman | |
parent | 2915af94a5b9e208ca7a9fd414854017c967179d (diff) | |
download | mailman2-1a07013f3b027ea660ad9d6d4d551dd1c92adb6f.tar.gz mailman2-1a07013f3b027ea660ad9d6d4d551dd1c92adb6f.tar.xz mailman2-1a07013f3b027ea660ad9d6d4d551dd1c92adb6f.zip |
Backport from the trunk, and catalog regeneration.
Diffstat (limited to '')
-rw-r--r-- | Mailman/Handlers/AvoidDuplicates.py | 31 | ||||
-rw-r--r-- | Mailman/Handlers/ToDigest.py | 6 | ||||
-rw-r--r-- | Mailman/MailList.py | 2 | ||||
-rw-r--r-- | Mailman/Mailbox.py | 26 | ||||
-rw-r--r-- | Mailman/Version.py | 2 |
5 files changed, 44 insertions, 23 deletions
diff --git a/Mailman/Handlers/AvoidDuplicates.py b/Mailman/Handlers/AvoidDuplicates.py index af740da2..b388a3d8 100644 --- a/Mailman/Handlers/AvoidDuplicates.py +++ b/Mailman/Handlers/AvoidDuplicates.py @@ -1,17 +1,17 @@ -# Copyright (C) 2002 by the Free Software Foundation, Inc. +# Copyright (C) 2002-2003 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 # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """If the user wishes it, do not send duplicates of the same message. @@ -22,9 +22,16 @@ has already received a copy, we either drop the message, add a duplicate warning header, or pass it through, depending on the user's preferences. """ +from email.Utils import getaddresses, formataddr from Mailman import mm_cfg -from email.Utils import getaddresses, formataddr +COMMASPACE = ', ' + +try: + True, False +except NameError: + True = 1 + False = 0 @@ -38,7 +45,7 @@ def process(mlist, msg, msgdata): listaddrs = [mlist.GetListEmail(), mlist.GetBouncesEmail(), mlist.GetOwnerEmail(), mlist.GetRequestEmail()] for addr in listaddrs: - explicit_recips[addr] = 1 + explicit_recips[addr] = True # Figure out the set of explicit recipients ccaddrs = {} for header in ('to', 'cc', 'resent-to', 'resent-cc'): @@ -50,7 +57,7 @@ def process(mlist, msg, msgdata): if not addr: continue # Ignore the list addresses for purposes of dup avoidance - explicit_recips[addr] = 1 + explicit_recips[addr] = True # Now strip out the list addresses for addr in listaddrs: del explicit_recips[addr] @@ -61,18 +68,18 @@ def process(mlist, msg, msgdata): for r in recips: # If this recipient is explicitly addressed... if explicit_recips.has_key(r): - send_duplicate = 1 + send_duplicate = True # If the member wants to receive duplicates, or if the recipient # is not a member at all, just flag the X-Mailman-Duplicate: yes # header. if mlist.isMember(r) and \ mlist.getMemberOption(r, mm_cfg.DontReceiveDuplicates): - send_duplicate = 0 + send_duplicate = False # We'll send a duplicate unless the user doesn't wish it. If # personalization is enabled, the add-dupe-header flag will add a # X-Mailman-Duplicate: yes header for this user's message. if send_duplicate: - msgdata.setdefault('add-dup-header', {})[r] = 1 + msgdata.setdefault('add-dup-header', {})[r] = True newrecips.append(r) elif ccaddrs.has_key(r): del ccaddrs[r] @@ -83,6 +90,6 @@ def process(mlist, msg, msgdata): newrecips.append(r) # Set the new list of recipients msgdata['recips'] = newrecips + # RFC 2822 specifies zero or one CC header del msg['cc'] - for item in ccaddrs.values(): - msg['cc'] = formataddr(item) + msg['Cc'] = COMMASPACE.join([formataddr(i) for i in ccaddrs.values()]) diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 3506beaa..b25b1f4f 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -27,6 +27,7 @@ import os import re +import copy import time from types import ListType from cStringIO import StringIO @@ -289,8 +290,9 @@ def send_i18n_digests(mlist, mboxfp): mimemsg.attach(mimedigest) first = True for msg in messages: - # MIME - mimedigest.attach(MIMEMessage(msg)) + # MIME. Make a copy of the message object since the rfc1153 + # processing scrubs out attachments. + mimedigest.attach(MIMEMessage(copy.deepcopy(msg))) # rfc1153 if first: first = False diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 67f0329c..e0bcc893 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -1041,6 +1041,8 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, mlist = MailList(listname, lock=0) if mlist.host_name <> self.host_name: continue + if not mlist.isMember(oldaddr): + continue mlist.Lock() try: mlist.changeMemberAddress(oldaddr, newaddr) diff --git a/Mailman/Mailbox.py b/Mailman/Mailbox.py index 8ab085cc..931c5429 100644 --- a/Mailman/Mailbox.py +++ b/Mailman/Mailbox.py @@ -1,17 +1,17 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2003 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 # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """Extend mailbox.UnixMailbox. @@ -21,13 +21,20 @@ import sys import mailbox import email -from email.Generator import Generator from email.Parser import Parser +from email.Generator import Generator from email.Errors import MessageParseError from Mailman import mm_cfg from Mailman.Message import Message +try: + True, False +except NameError: + True = 1 + False = 0 + + def _safeparser(fp): try: @@ -44,8 +51,8 @@ class Mailbox(mailbox.PortableUnixMailbox): # msg should be an rfc822 message or a subclass. def AppendMessage(self, msg): - # Check the last character of the file and write a newline if it isn't - # a newline (but not at the beginning of an empty file). + # Check the last character of the file and write a newline if it isn't + # a newline (but not at the beginning of an empty file). try: self.fp.seek(-1, 2) except IOError, e: @@ -59,7 +66,10 @@ class Mailbox(mailbox.PortableUnixMailbox): self.fp.seek(1, 2) # Create a Generator instance to write the message to the file g = Generator(self.fp) - g(msg, unixfrom=1) + g.flatten(msg, unixfrom=True) + # Add one more trailing newline for separation with the next message + # to be appended to the mbox. + print >> self.fp diff --git a/Mailman/Version.py b/Mailman/Version.py index 5465cdd4..089016fd 100644 --- a/Mailman/Version.py +++ b/Mailman/Version.py @@ -15,7 +15,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Mailman version -VERSION = "2.1.1-01-Apr-2003" +VERSION = "2.1.1++" # And as a hex number in the manner of PY_VERSION_HEX ALPHA = 0xa |