Merge pull request #135 from me-and/fix-date-exception-handling
Skip parsing date after failing to parse the date
This commit is contained in:
commit
da5d0641c5
@ -396,13 +396,12 @@ class MaildirFolder(BaseFolder):
|
|||||||
message_timestamp = self.get_message_date(
|
message_timestamp = self.get_message_date(
|
||||||
msg, 'Delivery-date')
|
msg, 'Delivery-date')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# This should never happen.
|
# Extracting the date has failed for some reason, such as it
|
||||||
|
# being in an invalid format.
|
||||||
from offlineimap.ui import getglobalui
|
from offlineimap.ui import getglobalui
|
||||||
datestr = self.get_message_date(msg)
|
|
||||||
ui = getglobalui()
|
ui = getglobalui()
|
||||||
ui.warn("UID %d has invalid date %s: %s\n"
|
ui.warn("UID %d has invalid date: %s\n"
|
||||||
"Not using message timestamp as file prefix" %
|
"Not using message timestamp as file prefix" % (uid, e))
|
||||||
(uid, datestr, e))
|
|
||||||
# No need to check if message_timestamp is None here since it
|
# No need to check if message_timestamp is None here since it
|
||||||
# would be overridden by _gettimeseq.
|
# would be overridden by _gettimeseq.
|
||||||
messagename = self.new_message_filename(uid, flags, date=message_timestamp)
|
messagename = self.new_message_filename(uid, flags, date=message_timestamp)
|
||||||
@ -414,14 +413,13 @@ class MaildirFolder(BaseFolder):
|
|||||||
if date is not None:
|
if date is not None:
|
||||||
os.utime(os.path.join(self.getfullname(), tmpname),
|
os.utime(os.path.join(self.getfullname(), tmpname),
|
||||||
(date, date))
|
(date, date))
|
||||||
# In case date is wrongly so far into the future as to be > max
|
|
||||||
# int32.
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
# Extracting the date has failed for some reason, such as it
|
||||||
|
# being in an invalid format.
|
||||||
from offlineimap.ui import getglobalui
|
from offlineimap.ui import getglobalui
|
||||||
datestr = self.get_message_date(msg)
|
|
||||||
ui = getglobalui()
|
ui = getglobalui()
|
||||||
ui.warn("UID %d has invalid date %s: %s\n"
|
ui.warn("UID %d has invalid date: %s\n"
|
||||||
"Not changing file modification time" % (uid, datestr, e))
|
"Not changing file modification time" % (uid, e))
|
||||||
|
|
||||||
self.messagelist[uid] = self.msglist_item_initializer(uid)
|
self.messagelist[uid] = self.msglist_item_initializer(uid)
|
||||||
self.messagelist[uid]['flags'] = flags
|
self.messagelist[uid]['flags'] = flags
|
||||||
|
Loading…
Reference in New Issue
Block a user