minor: add comments

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2015-01-11 13:54:53 +01:00
parent c2b8a99fa2
commit a44718130d
4 changed files with 14 additions and 0 deletions

View File

@ -33,15 +33,21 @@ except:
# FIXME: spaghetti code alert!
def getaccountlist(customconfig):
# Account names in a list.
return customconfig.getsectionlist('Account')
# FIXME: spaghetti code alert!
def AccountListGenerator(customconfig):
"""Returns a list of instanciated Account class, one per account name."""
return [Account(customconfig, accountname)
for accountname in getaccountlist(customconfig)]
# FIXME: spaghetti code alert!
def AccountHashGenerator(customconfig):
"""Returns a dict of instanciated Account class with the account name as
key."""
retval = {}
for item in AccountListGenerator(customconfig):
retval[item.getname()] = item

View File

@ -40,6 +40,8 @@ CRLF = '\r\n'
class IMAPFolder(BaseFolder):
def __init__(self, imapserver, name, repository):
# FIXME: decide if unquoted name is from the responsability of the
# caller or not, but not both.
name = imaputil.dequote(name)
self.sep = imapserver.delim
super(IMAPFolder, self).__init__(name, repository)

View File

@ -321,6 +321,8 @@ class OfflineImap:
pass
try:
# Honor CLI --account option, only.
# Accounts to sync are put into syncaccounts variable.
activeaccounts = self.config.get("general", "accounts")
if options.accounts:
activeaccounts = options.accounts

View File

@ -301,6 +301,8 @@ class IMAPRepository(BaseRepository):
return None
def getfolder(self, foldername):
"""Return instance of OfflineIMAP representative folder."""
return self.getfoldertype()(self.imapserver, foldername, self)
def getfoldertype(self):
@ -314,6 +316,8 @@ class IMAPRepository(BaseRepository):
self.folders = None
def getfolders(self):
"""Return a list of instances of OfflineIMAP representative folder."""
if self.folders != None:
return self.folders
retval = []