summaryrefslogtreecommitdiff
path: root/Mailman/Archiver.py
diff options
context:
space:
mode:
authorcotton1998-10-20 13:12:09 +0000
committercotton1998-10-20 13:12:09 +0000
commitff27278853c18121bdf9659522d97b8779d1a18f (patch)
tree9d198c536753e342e8b7b7c374622817a968e642 /Mailman/Archiver.py
parent95039247e3b3a444947aab043fe34b59bc80d824 (diff)
downloadmailman-ff27278853c18121bdf9659522d97b8779d1a18f.tar.gz
mailman-ff27278853c18121bdf9659522d97b8779d1a18f.tar.zst
mailman-ff27278853c18121bdf9659522d97b8779d1a18f.zip
reinstated old archive to mbox mechanism, but made it configurable to
use mbox archiving only, to use builtin mailman html archiving only, or to use both. this is done with the ARCHIVE_TO_MBOX config variable in Defaults.py. It is set to do both by default to help those that have an external archiver change to the built in one if they want to. scott
Diffstat (limited to 'Mailman/Archiver.py')
-rw-r--r--Mailman/Archiver.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/Mailman/Archiver.py b/Mailman/Archiver.py
index b4d9e4fdf..5e4e836f5 100644
--- a/Mailman/Archiver.py
+++ b/Mailman/Archiver.py
@@ -1,3 +1,4 @@
+
# Copyright (C) 1998 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
@@ -108,6 +109,30 @@ class Archiver:
f.truncate(0)
f.close()
+ #
+ # old ArchiveMail function, retained under a new name
+ # for those
+ # who still want to use an external archiver
+ #
+ def ArchiveToMbox(self, post):
+ """Retain a text copy of the message in an mbox file."""
+ if self.clobber_date:
+ import time
+ olddate = post.getheader('date')
+ post.SetHeader('Date', time.ctime(time.time()))
+ try:
+ afn = self.ArchiveFileName()
+ mbox = self.ArchiveFile(afn)
+ mbox.AppendMessage(post)
+ mbox.fp.close()
+ except IOError, msg:
+ self.LogMsg("error", ("Archive file access failure:\n"
+ "\t%s %s"
+ % (afn, `msg[1]`)))
+ if self.clobber_date:
+ # Resurrect original date setting.
+ post.SetHeader('Date', olddate)
+ self.Save ()
#
# archiving in real time this is called from list.post(msg)
@@ -119,6 +144,17 @@ class Archiver:
#
if os.fork():
return
+ #
+ # archive to mbox only
+ #
+ if mm_cfg.ARCHIVE_TO_MBOX == 1:
+ self.ArchiveToMbox(msg)
+ return
+ #
+ # archive to both mbox and built in html archiver
+ #
+ elif mm_cfg.ARCHIVE_TO_MBOX == 2:
+ self.ArchiveToMbox(msg)
try:
from cStringIO import StringIO
except ImportError: