From ba6857bc87bb2f159896719a4eafefa9fcf11f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Mon, 12 Oct 2020 12:40:54 +0200 Subject: [PATCH] Remove email.Parse The Parse funcion was deprecated in python 2.4. We can use this new code. --- offlineimap/folder/Maildir.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index ca42e13..205feea 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -366,9 +366,8 @@ class MaildirFolder(BaseFolder): content, 'Delivery-date') except Exception as e: # This should never happen. - from email.Parser import Parser from offlineimap.ui import getglobalui - datestr = Parser().parsestr(content, True).get("Date") + datestr = emailutil.get_message_date(content) ui = getglobalui() ui.warn("UID %d has invalid date %s: %s\n" "Not using message timestamp as file prefix" % @@ -387,9 +386,8 @@ class MaildirFolder(BaseFolder): # In case date is wrongly so far into the future as to be > max # int32. except Exception as e: - from email.Parser import Parser from offlineimap.ui import getglobalui - datestr = Parser().parsestr(content, True).get("Date") + datestr = emailutil.get_message_date(content) ui = getglobalui() ui.warn("UID %d has invalid date %s: %s\n" "Not changing file modification time" % (uid, datestr, e))