summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-10-15 21:37:00 +0000
committerbwarsaw2001-10-15 21:37:00 +0000
commitccb90b99cbe5168bcd3b72e3277ab5ec02e8156a (patch)
tree29cf8dbd8dfb326ad6956477d162104edd85a3be
parentaec38fef609e79c2b930b06a178523c1ab1dc04c (diff)
downloadmailman-ccb90b99cbe5168bcd3b72e3277ab5ec02e8156a.tar.gz
mailman-ccb90b99cbe5168bcd3b72e3277ab5ec02e8156a.tar.zst
mailman-ccb90b99cbe5168bcd3b72e3277ab5ec02e8156a.zip
-rw-r--r--Mailman/Mailbox.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Mailman/Mailbox.py b/Mailman/Mailbox.py
index df8670fb9..2d61427af 100644
--- a/Mailman/Mailbox.py
+++ b/Mailman/Mailbox.py
@@ -18,11 +18,27 @@
"Extend mailbox.UnixMailbox."
from email.Generator import Generator
+from email.Parser import Parser
+
+from Mailman.Message import Message
from Mailman.pythonlib import mailbox
+
+# Factory callable for UnixMailboxes. This ensures that any object we get out
+# of the mailbox is an instance of our subclass. (requires Python 2.1's
+# mailbox module)
+def _factory(fp):
+ p = Parser(Message)
+ return p.parse(fp)
+
+
+
class Mailbox(mailbox.PortableUnixMailbox):
+ def __init__(self, fp):
+ mailbox.PortableUnixMailbox.__init__(self, fp, _factory)
+
# 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