From 57ba2d0e859368fe01f4b5563249e0f1b834aa4c Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Thu, 18 Jul 2002 22:50:50 +0100 Subject: [PATCH] /offlineimap/head: changeset 143 No longer throws an exception when updating messages with strange Date headers; will just set IMAP Internaldate to the current date. --- offlineimap/head/debian/changelog | 4 +++- offlineimap/head/offlineimap/folder/IMAP.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/offlineimap/head/debian/changelog b/offlineimap/head/debian/changelog index 7f0f6c6..23a84d4 100644 --- a/offlineimap/head/debian/changelog +++ b/offlineimap/head/debian/changelog @@ -1,6 +1,8 @@ offlineimap (3.0.3) unstable; urgency=low - * Placeholder. + * No longer throws an exception when updating messages with strange + Date headers; will just set IMAP Internaldate to the current date. + Closes: #153425. -- John Goerzen Thu, 18 Jul 2002 17:46:13 -0500 diff --git a/offlineimap/head/offlineimap/folder/IMAP.py b/offlineimap/head/offlineimap/folder/IMAP.py index 85c15e0..91e2e85 100644 --- a/offlineimap/head/offlineimap/folder/IMAP.py +++ b/offlineimap/head/offlineimap/folder/IMAP.py @@ -18,7 +18,7 @@ from Base import BaseFolder from offlineimap import imaputil, imaplib -import rfc822 +import rfc822, time from StringIO import StringIO from copy import copy @@ -105,7 +105,10 @@ class IMAPFolder(BaseFolder): message = rfc822.Message(StringIO(content)) mid = imapobj._quote(message.getheader('Message-Id')) - date = imaplib.Time2Internaldate(rfc822.parsedate(message.getheader('Date'))) + datetuple = rfc822.parsedate(message.getheader('Date')) + if datetuple == None: + datetuple = time.localtime() + date = imaplib.Time2Internaldate(datetuple) if content.find("\r\n") == -1: # Convert line endings if not already content = content.replace("\n", "\r\n")