six: changed offlineimap/folder/IMAP.py

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) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix) 2020-09-03 20:53:33 +02:00
parent ba11b2d684
commit cefac73af4

View File

@ -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()