diff options
| author | bwarsaw | 2000-09-14 06:07:37 +0000 |
|---|---|---|
| committer | bwarsaw | 2000-09-14 06:07:37 +0000 |
| commit | 6f85c0173a167151b6de47e8c77231127e319f67 (patch) | |
| tree | 71edfcda35049d9153dfd894d3db18fedda85a8f | |
| parent | 65157676228ae59402c937ca7ee50b1aa18baf30 (diff) | |
| download | mailman-6f85c0173a167151b6de47e8c77231127e319f67.tar.gz mailman-6f85c0173a167151b6de47e8c77231127e319f67.tar.zst mailman-6f85c0173a167151b6de47e8c77231127e319f67.zip | |
process(): Do the clobber_date logic here instead of in
Archiver/Archiver.py, because We want clobber_date to affect what goes
in Pipermail or the external archiver. Be sure to restore the
original date after the archiver gets its hands on the message. If
clobber_date is turned on, set the X-Original-Date: header to the
original Date: field value.
| -rw-r--r-- | Mailman/Handlers/ToArchive.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Mailman/Handlers/ToArchive.py b/Mailman/Handlers/ToArchive.py index 9c51e93c2..f59420a7b 100644 --- a/Mailman/Handlers/ToArchive.py +++ b/Mailman/Handlers/ToArchive.py @@ -17,6 +17,7 @@ """Add the message to the archives.""" import string +import time @@ -27,5 +28,23 @@ def process(mlist, msg, msgdata): archivep = msg.getheader('x-archive') if archivep and string.lower(archivep) == 'no': return - # TBD: this needs to be converted to the new pipeline machinery - mlist.ArchiveMail(msg, msgdata) + # + # TBD: This is a kludge around the archiver to properly support + # clobber_date, which sets the date in the archive to the resent date + # (i.e. now) instead of the potentially bogus date in the original + # message. We still want the outgoing message to contain the Date: header + # as originally sent. + # + # Note that there should be a third option here: to clobber the date only + # if it's bogus, i.e. way in the future or way in the past. + date = archivedate = msg.getheader('date') + try: + if mlist.clobber_date: + archivedate = time.ctime(time.time()) + msg['Date'] = archivedate + msg['X-Original-Date'] = date + # TBD: this needs to be converted to the new pipeline machinery + mlist.ArchiveMail(msg, msgdata) + finally: + # Restore the original date + msg['Date'] = date |
