/offlineimap/head: changeset 233
Made more resiliant in the face of invalid dates.
This commit is contained in:
parent
1c29a7206e
commit
9d1a4e2275
@ -6,6 +6,7 @@ offlineimap (3.2.5) unstable; urgency=low
|
||||
options: pythonfile and foldersort. Fixes [complete.org #29], and
|
||||
for Debian, Closes: #155637.
|
||||
* Added documentation for the above features.
|
||||
* Even more resiliant in the face of invalid Date headers. Closes: #155994.
|
||||
|
||||
-- John Goerzen <jgoerzen@complete.org> Fri, 9 Aug 2002 17:54:01 -0500
|
||||
|
||||
|
@ -118,10 +118,15 @@ class IMAPFolder(BaseFolder):
|
||||
if datetuple == None:
|
||||
datetuple = time.localtime()
|
||||
try:
|
||||
if datetuple[0] < 1981:
|
||||
raise ValueError
|
||||
# This could raise a value error if it's not a valid format.
|
||||
date = imaplib.Time2Internaldate(datetuple)
|
||||
except ValueError:
|
||||
# Argh, sometimes it's a valid format but year is 0102
|
||||
# or something. Argh.
|
||||
# or something. Argh. It seems that Time2Internaldate
|
||||
# will rause a ValueError if the year is 0102 but not 1902,
|
||||
# but some IMAP servers nonetheless choke on 1902.
|
||||
date = imaplib.Time2Internaldate(time.localtime())
|
||||
|
||||
if content.find("\r\n") == -1: # Convert line endings if not already
|
||||
|
Loading…
Reference in New Issue
Block a user