Determine folder syncing on Folder initialization
Rather than later when retrieving them by IMAP, we determine the "sync_this" value of a folder on Folder() initialization. This also fixes a bug where folder structure was not propagated when a folder was filtered out but included in the folderincludes list. Patch by Dave, split and modified slightly by Sebastian Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:

committed by
Sebastian Spaeth

parent
e7ca5b25cb
commit
e94642bb4d
@ -31,9 +31,12 @@ class BaseFolder(object):
|
||||
:para name: Path & name of folder minus root or reference
|
||||
:para repository: Repository() in which the folder is.
|
||||
"""
|
||||
self.sync_this = True
|
||||
"""Should this folder be included in syncing?"""
|
||||
self.ui = getglobalui()
|
||||
"""Should this folder be included in syncing?"""
|
||||
self._sync_this = repository.should_sync_folder(name)
|
||||
if not self._sync_this:
|
||||
self.ui.debug('', "Filtering out '%s'[%s] due to folderfilter" \
|
||||
% (name, repository))
|
||||
# Top level dir name is always ''
|
||||
self.name = name if not name == self.getsep() else ''
|
||||
self.repository = repository
|
||||
@ -57,6 +60,11 @@ class BaseFolder(object):
|
||||
"""Account name as string"""
|
||||
return self.repository.accountname
|
||||
|
||||
@property
|
||||
def sync_this(self):
|
||||
"""Should this folder be synced or is it e.g. filtered out?"""
|
||||
return self._sync_this
|
||||
|
||||
def suggeststhreads(self):
|
||||
"""Returns true if this folder suggests using threads for actions;
|
||||
false otherwise. Probably only IMAP will return true."""
|
||||
|
Reference in New Issue
Block a user