py3: raise exceptions using six module

There is no other way to make Python2 and Python3 happy, because syntax
raise E, V, T is incompatible with the latter.

Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Łukasz Żarnowiecki
2016-05-17 19:56:52 +02:00
committed by Nicolas Sebrecht
parent 83539f8601
commit 0addcbabf0
13 changed files with 70 additions and 49 deletions

View File

@ -28,6 +28,8 @@ from offlineimap.ui import getglobalui
from offlineimap import OfflineImapError
from offlineimap.imaplib2 import IMAP4, IMAP4_SSL, zlib, InternalDate, Mon2num
import six
class UsefulIMAPMixIn(object):
def __getselectedfolder(self):
@ -56,7 +58,7 @@ class UsefulIMAPMixIn(object):
errstr = "Server '%s' closed connection, error on SELECT '%s'. Ser"\
"ver said: %s" % (self.host, mailbox, e.args[0])
severity = OfflineImapError.ERROR.FOLDER_RETRY
raise OfflineImapError(errstr, severity), None, exc_info()[2]
six.reraise(OfflineImapError(errstr, severity), None, exc_info()[2])
if result[0] != 'OK':
#in case of error, bail out with OfflineImapError
errstr = "Error SELECTing mailbox '%s', server reply:\n%s" %\