[PATCH] imapserver.py: Make severity var available where it is needed
Sebastian Spaeth
Sebastian at SSpaeth.de
Mon Jun 27 10:08:54 BST 2011
We we using the variable 'severity' in a few places to throw
OfflineImapErrorrs of severity REPO. Somehow, that variable is now not
accessilble in all places that refer to it, so we move where it is
defined to before all the 'if' checks which might make use of it.
Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
Against 'next', this fixes potential crashes using an undefined variable.
offlineimap/imapserver.py | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index 77a3c38..0713eb8 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -292,9 +292,9 @@ class IMAPServer:
if(self.connectionlock.locked()):
self.connectionlock.release()
+ severity = OfflineImapError.ERROR.REPO
if type(e) == gaierror:
#DNS related errors. Abort Repo sync
- severity = OfflineImapError.ERROR.REPO
#TODO: special error msg for e.errno == 2 "Name or service not known"?
reason = "Could not resolve name '%s' for repository "\
"'%s'. Make sure you have configured the ser"\
@@ -328,8 +328,7 @@ class IMAPServer:
if str(e)[:24] == "can't open socket; error":
raise OfflineImapError("Could not connect to remote server '%s' "\
"for repository '%s'. Remote does not answer."
- % (self.hostname, self.reposname),
- OfflineImapError.ERROR.REPO)
+ % (self.hostname, self.reposname), severity)
else:
# re-raise all other errors
raise
--
1.7.4.1
More information about the OfflineIMAP-project
mailing list