summaryrefslogtreecommitdiff
path: root/Mailman/Mailbox.py
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/Mailbox.py')
-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