Backwards compatibility for python 2.4

Python 2.4 doesn't allow try...except...finally clauses, see PEP
341. Also, yield statements inside try...finally is not allowed. The
commit changes the logic to no longer use those syntactical features.

Signed-off-by: Nicolas Sebrecht <ni.s@laposte.net>
This commit is contained in:
Janne Blomqvist 2010-11-16 21:36:25 +02:00 committed by Nicolas Sebrecht
parent 1deb8442a5
commit d687999a66

View File

@ -84,8 +84,10 @@ class SigListener(Queue):
self.folderlock.release()
yield (folder, quick)
self.folderlock.acquire()
finally:
except:
self.folderlock.release()
raise
self.folderlock.release()
def getaccountlist(customconfig):
return customconfig.getsectionlist('Account')
@ -183,10 +185,11 @@ class AccountSynchronizationMixin:
#might need changes here to ensure that one account sync does not crash others...
if not self.refreshperiod:
try:
self.sync(siglistener)
except:
self.ui.warn("Error occured attempting to sync account " + self.name \
+ ": " + str(sys.exc_info()[1]))
try:
self.sync(siglistener)
except:
self.ui.warn("Error occured attempting to sync account " + self.name \
+ ": " + str(sys.exc_info()[1]))
finally:
self.ui.acctdone(self.name)
@ -196,10 +199,11 @@ class AccountSynchronizationMixin:
looping = 1
while looping:
try:
self.sync(siglistener)
except:
self.ui.warn("Error occured attempting to sync account " + self.name \
+ ": " + str(sys.exc_info()[1]))
try:
self.sync(siglistener)
except:
self.ui.warn("Error occured attempting to sync account " + self.name \
+ ": " + str(sys.exc_info()[1]))
finally:
looping = self.sleeper(siglistener) != 2
self.ui.acctdone(self.name)