Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove 'config' as parameter from BaseFolder & derivatives

It is possible to get the config parameter from the Repository() which is
set in BaseFolder, so we set self.config there and remove the various
methods and 'config' parameters that are superfluous.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
  • Loading branch information...
commit ee75e0921ff105d19f619973dba188fc6900ff45 1 parent 410e2d3
@spaetz spaetz authored committed
View
1  offlineimap/folder/Base.py
@@ -36,6 +36,7 @@ def __init__(self, name, repository):
self.ui = getglobalui()
self.name = name
self.repository = repository
+ self.config = repository.getconfig()
def getname(self):
"""Returns name"""
View
1  offlineimap/folder/IMAP.py
@@ -35,7 +35,6 @@ class IMAPFolder(BaseFolder):
def __init__(self, imapserver, name, visiblename, repository):
name = imaputil.dequote(name)
super(IMAPFolder, self).__init__(name, repository)
- self.config = imapserver.config
self.expunge = repository.getexpunge()
self.root = None # imapserver.root
self.sep = imapserver.delim
View
6 offlineimap/folder/LocalStatus.py
@@ -26,15 +26,15 @@
magicline = "OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1"
class LocalStatusFolder(BaseFolder):
- def __init__(self, root, name, repository, config):
+ def __init__(self, root, name, repository):
super(LocalStatusFolder, self).__init__(name, repository)
self.root = root
self.sep = '.'
- self.config = config
self.filename = os.path.join(root, self.getfolderbasename())
self.messagelist = {}
self.savelock = threading.Lock()
- self.doautosave = config.getdefaultboolean("general", "fsync", False)
+ self.doautosave = self.config.getdefaultboolean("general", "fsync",
+ False)
"""Should we perform fsyncs as often as possible?"""
def storesmessages(self):
View
5 offlineimap/folder/LocalStatusSQLite.py
@@ -46,10 +46,9 @@ class LocalStatusSQLiteFolder(LocalStatusFolder):
#current version of our db format
cur_version = 1
- def __init__(self, root, name, repository, config):
+ def __init__(self, root, name, repository):
super(LocalStatusSQLiteFolder, self).__init__(root, name,
- repository,
- config)
+ repository)
# dblock protects against concurrent writes in same connection
self._dblock = Lock()
View
5 offlineimap/folder/Maildir.py
@@ -58,10 +58,9 @@ def gettimeseq():
timelock.release()
class MaildirFolder(BaseFolder):
- def __init__(self, root, name, sep, repository, config):
+ def __init__(self, root, name, sep, repository):
super(MaildirFolder, self).__init__(name, repository)
- self.config = config
- self.dofsync = config.getdefaultboolean("general", "fsync", True)
+ self.dofsync = self.config.getdefaultboolean("general", "fsync", True)
self.root = root
self.sep = sep
self.messagelist = None
View
3  offlineimap/repository/LocalStatus.py
@@ -83,8 +83,7 @@ def makefolder(self, foldername):
def getfolder(self, foldername):
"""Return the Folder() object for a foldername"""
return self.LocalStatusFolderClass(self.directory, foldername,
- self,
- self.config)
+ self)
def getfolders(self):
"""Returns a list of all cached folders."""
View
6 offlineimap/repository/Maildir.py
@@ -117,8 +117,7 @@ def getfolder(self, foldername):
if self.config.has_option('Repository ' + self.name, 'restoreatime') and self.config.getboolean('Repository ' + self.name, 'restoreatime'):
self._append_folder_atimes(foldername)
return folder.Maildir.MaildirFolder(self.root, foldername,
- self.getsep(), self,
- self.config)
+ self.getsep(), self)
def _getfolders_scandir(self, root, extension = None):
"""Recursively scan folder 'root'; return a list of MailDirFolder
@@ -167,8 +166,7 @@ def _getfolders_scandir(self, root, extension = None):
retval.append(folder.Maildir.MaildirFolder(self.root,
foldername,
self.getsep(),
- self,
- self.config))
+ self))
if self.getsep() == '/' and dirname != '.':
# Recursively check sub-directories for folders too.
retval.extend(self._getfolders_scandir(root, foldername))
Please sign in to comment.
Something went wrong with that request. Please try again.