aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Mailbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Mailbox.py')
-rw-r--r--Mailman/Mailbox.py26
1 files changed, 18 insertions, 8 deletions
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