From cefac73af45596caff8fedea79ae90d9260c33ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Thu, 3 Sep 2020 20:53:33 +0200 Subject: [PATCH] six: changed offlineimap/folder/IMAP.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes the library six, compatible with python2. I need change these re-raise calls. Signed-off-by: Rodolfo García Peñas (kix) --- offlineimap/folder/IMAP.py | 39 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index ccbaf88..53004a8 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -20,8 +20,6 @@ import binascii import re import time from sys import exc_info -import six - from offlineimap import imaputil, imaplibutil, emailutil, OfflineImapError from offlineimap import globals from imaplib2 import MonthNames @@ -115,11 +113,10 @@ class IMAPFolder(BaseFolder): def getmaxage(self): if self.config.getdefault("Account %s" % self.accountname, "maxage", None): - six.reraise(OfflineImapError, - OfflineImapError( - "maxage is not supported on IMAP-IMAP sync", - OfflineImapError.ERROR.REPO), - exc_info()[2]) + raise OfflineImapError( + "maxage is not supported on IMAP-IMAP sync", + OfflineImapError.ERROR.REPO, + exc_info()[2]) # Interface from BaseFolder def getinstancelimitnamespace(self): @@ -690,13 +687,14 @@ class IMAPFolder(BaseFolder): self.imapserver.releaseconnection(imapobj, True) imapobj = self.imapserver.acquireconnection() if not retry_left: - six.reraise(OfflineImapError, - OfflineImapError("Saving msg (%s) in folder '%s', " - "repository '%s' failed (abort). Server responded: %s\n" - "Message content was: %s" % - (msg_id, self, self.getrepository(), str(e), dbg_output), - OfflineImapError.ERROR.MESSAGE), - exc_info()[2]) + raise OfflineImapError( + "Saving msg (%s) in folder '%s', " + "repository '%s' failed (abort). Server responded: %s\n" + "Message content was: %s" % + (msg_id, self, self.getrepository(), str(e), dbg_output), + OfflineImapError.ERROR.MESSAGE, + exc_info()[2]) + # XXX: is this still needed? self.ui.error(e, exc_info()[2]) except imapobj.error as e: # APPEND failed @@ -705,12 +703,13 @@ class IMAPFolder(BaseFolder): # drop conn, it might be bad. self.imapserver.releaseconnection(imapobj, True) imapobj = None - six.reraise(OfflineImapError, - OfflineImapError("Saving msg (%s) folder '%s', repo '%s'" - "failed (error). Server responded: %s\nMessage content was: " - "%s" % (msg_id, self, self.getrepository(), str(e), dbg_output), - OfflineImapError.ERROR.MESSAGE), - exc_info()[2]) + raise OfflineImapError( + "Saving msg (%s) folder '%s', repo '%s'" + "failed (error). Server responded: %s\nMessage content was: " + "%s" % (msg_id, self, self.getrepository(), str(e), dbg_output), + OfflineImapError.ERROR.MESSAGE, + exc_info()[2]) + # Checkpoint. Let it write out stuff, etc. Eg searches for # just uploaded messages won't work if we don't do this. (typ, dat) = imapobj.check()