summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw2012-03-23 21:45:12 -0400
committerBarry Warsaw2012-03-23 21:45:12 -0400
commit0af4f1311349f8352743bcabda0afbe5e0677635 (patch)
tree21476c19fe2e9a9c55150961046e7ff7a365548f /src
parent9e3dd4dec9260651d47b24cd9732f2fa71508561 (diff)
downloadmailman-0af4f1311349f8352743bcabda0afbe5e0677635.tar.gz
mailman-0af4f1311349f8352743bcabda0afbe5e0677635.tar.zst
mailman-0af4f1311349f8352743bcabda0afbe5e0677635.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/runners/archive.py57
-rw-r--r--src/mailman/runners/tests/test_archiver.py16
2 files changed, 44 insertions, 29 deletions
diff --git a/src/mailman/runners/archive.py b/src/mailman/runners/archive.py
index ea85281b1..1c0a24785 100644
--- a/src/mailman/runners/archive.py
+++ b/src/mailman/runners/archive.py
@@ -50,34 +50,35 @@ class ArchiveRunner(Runner):
clobber = False
original_date = msg.get('date')
received_time = formatdate(msgdata['received_time'])
- if not original_date:
- clobber = True
- elif int(config.archiver.pipermail.clobber_date_policy) == 1:
- clobber = True
- elif int(config.archiver.pipermail.clobber_date_policy) == 2:
- # What's the timestamp on the original message?
- timetup = parsedate_tz(original_date)
- now = datetime.now()
- try:
- if not timetup:
- clobber = True
- else:
- utc_timestamp = datetime.fromtimestamp(mktime_tz(timetup))
- date_skew = as_timedelta(
- config.archiver.pipermail.allowable_sane_date_skew)
- clobber = (abs(now - utc_timestamp) > date_skew)
- except (ValueError, OverflowError):
- # The likely cause of this is that the year in the Date: field
- # is horribly incorrect, e.g. (from SF bug # 571634):
- # Date: Tue, 18 Jun 0102 05:12:09 +0500
- # Obviously clobber such dates.
- clobber = True
- if clobber:
- del msg['date']
- del msg['x-original-date']
- msg['Date'] = received_time
- if original_date:
- msg['X-Original-Date'] = original_date
+ # FIXME 2012-03-23 BAW: LP: #963612
+ ## if not original_date:
+ ## clobber = True
+ ## elif int(config.archiver.pipermail.clobber_date_policy) == 1:
+ ## clobber = True
+ ## elif int(config.archiver.pipermail.clobber_date_policy) == 2:
+ ## # What's the timestamp on the original message?
+ ## timetup = parsedate_tz(original_date)
+ ## now = datetime.now()
+ ## try:
+ ## if not timetup:
+ ## clobber = True
+ ## else:
+ ## utc_timestamp = datetime.fromtimestamp(mktime_tz(timetup))
+ ## date_skew = as_timedelta(
+ ## config.archiver.pipermail.allowable_sane_date_skew)
+ ## clobber = (abs(now - utc_timestamp) > date_skew)
+ ## except (ValueError, OverflowError):
+ ## # The likely cause of this is that the year in the Date: field
+ ## # is horribly incorrect, e.g. (from SF bug # 571634):
+ ## # Date: Tue, 18 Jun 0102 05:12:09 +0500
+ ## # Obviously clobber such dates.
+ ## clobber = True
+ ## if clobber:
+ ## del msg['date']
+ ## del msg['x-original-date']
+ ## msg['Date'] = received_time
+ ## if original_date:
+ ## msg['X-Original-Date'] = original_date
# Always put an indication of when we received the message.
msg['X-List-Received-Date'] = received_time
# While a list archiving lock is acquired, archive the message.
diff --git a/src/mailman/runners/tests/test_archiver.py b/src/mailman/runners/tests/test_archiver.py
index 274aba5ec..865a2be67 100644
--- a/src/mailman/runners/tests/test_archiver.py
+++ b/src/mailman/runners/tests/test_archiver.py
@@ -85,6 +85,7 @@ class TestArchiveRunner(unittest.TestCase):
[archiver.mail_archive]
enable: no
""")
+ self._archiveq = config.switchboards['archive']
self._msg = mfs("""\
From: aperson@example.com
To: test@example.com
@@ -101,7 +102,20 @@ First post!
def test_archive_runner(self):
# Ensure that the archive runner ends up archiving the message.
- config.switchboards['archive'].enqueue(
+ self._archiveq.enqueue(
+ self._msg, {}, listname=self._mlist.fqdn_listname)
+ self._runner.run()
+ # There should now be a copy of the message in the file system.
+ filename = os.path.join(
+ config.MESSAGES_DIR, '4CMWUN6BHVCMHMDAOSJZ2Q72G5M32MWB')
+ with open(filename) as fp:
+ archived = message_from_file(fp)
+ self.assertEqual(archived['message-id'], '<first>')
+
+ def test_archive_runner_with_dated_message(self):
+ # LP: #963612 FIXME
+ self._msg['Date'] = 'Sat, 11 Mar 2011 03:19:38 -0500'
+ self._archiveq.enqueue(
self._msg, {}, listname=self._mlist.fqdn_listname)
self._runner.run()
# There should now be a copy of the message in the file system.