Set accountname in BaseFolder, and don't pass it in initialization
We passed in the accountname to all derivatives of BaseFolder, such as IMAPFolder(...,repository,...,accountname), although it is perfectly possible to get the accountname from the Repository(). So remove this unneeded parameter. Each backend had to define getaccountname() (although the function is hardly used and most accessed .accountname directly). On the other hand BaseFolder was using getaccountname but it never defined the function. So make the sane thing, remove all definitions from backends and define accountname() once in Basefolder. It was made a property and not just a (public) attribute, so it will show up in our developer documentation as public API. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:

committed by
Nicolas Sebrecht

parent
c93cd9bb1a
commit
410e2d35e9
@ -58,14 +58,13 @@ def gettimeseq():
|
||||
timelock.release()
|
||||
|
||||
class MaildirFolder(BaseFolder):
|
||||
def __init__(self, root, name, sep, repository, accountname, config):
|
||||
def __init__(self, root, name, sep, repository, config):
|
||||
super(MaildirFolder, self).__init__(name, repository)
|
||||
self.config = config
|
||||
self.dofsync = config.getdefaultboolean("general", "fsync", True)
|
||||
self.root = root
|
||||
self.sep = sep
|
||||
self.messagelist = None
|
||||
self.accountname = accountname
|
||||
|
||||
self.wincompatible = self.config.getdefaultboolean(
|
||||
"Account "+self.accountname, "maildir-windows-compatible", False)
|
||||
@ -80,9 +79,6 @@ class MaildirFolder(BaseFolder):
|
||||
# Cache the full folder path, as we use getfullname() very often
|
||||
self._fullname = os.path.join(self.getroot(), self.getname())
|
||||
|
||||
def getaccountname(self):
|
||||
return self.accountname
|
||||
|
||||
def getfullname(self):
|
||||
"""Return the absolute file path to the Maildir folder (sans cur|new)"""
|
||||
return self._fullname
|
||||
|
Reference in New Issue
Block a user