accounts.py: Merge AccountSynchronizationMixin with SyncableAccount class
AccountSynchronizationMixin was never used on its own and it is a very confusing class until you understand what it is used for. (It complemented the Account() class with a few methods to make Account() syncable. But we use the SyncableAccount class anyway, so merge the former Mixin' methods directly in there. This does away with a class that is not directly used, and was a case of over-object-orientation which confuses more than it helps. Touched up code documentation while going through the file. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
9afb432053
commit
465af6c481
@ -166,7 +166,12 @@ class Account(CustomConfig.ConfigHelperMixin):
|
|||||||
item.stopkeepalive()
|
item.stopkeepalive()
|
||||||
return sleepresult
|
return sleepresult
|
||||||
|
|
||||||
class AccountSynchronizationMixin:
|
|
||||||
|
class SyncableAccount(Account):
|
||||||
|
"""A syncable IMAP account.
|
||||||
|
|
||||||
|
Derives from class:`Account`."""
|
||||||
|
|
||||||
def syncrunner(self, siglistener):
|
def syncrunner(self, siglistener):
|
||||||
self.ui.registerthread(self.name)
|
self.ui.registerthread(self.name)
|
||||||
self.ui.acct(self.name)
|
self.ui.acct(self.name)
|
||||||
@ -285,12 +290,12 @@ class AccountSynchronizationMixin:
|
|||||||
self.ui.callhook("Hook return code: %d" % p.returncode)
|
self.ui.callhook("Hook return code: %d" % p.returncode)
|
||||||
except:
|
except:
|
||||||
self.ui.warn("Exception occured while calling hook")
|
self.ui.warn("Exception occured while calling hook")
|
||||||
|
|
||||||
class SyncableAccount(Account, AccountSynchronizationMixin):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def syncfolder(accountname, remoterepos, remotefolder, localrepos,
|
def syncfolder(accountname, remoterepos, remotefolder, localrepos,
|
||||||
statusrepos, quick):
|
statusrepos, quick):
|
||||||
|
"""This function is called as target for the
|
||||||
|
InstanceLimitedThread invokation in SyncableAccount."""
|
||||||
global mailboxes
|
global mailboxes
|
||||||
ui = getglobalui()
|
ui = getglobalui()
|
||||||
ui.registerthread(accountname)
|
ui.registerthread(accountname)
|
||||||
|
Loading…
Reference in New Issue
Block a user