Fix fallout when filtering folders

Previous commit e7ca5b25cb combined
checks for filtered folders in one place. However, it turns out there
was a reason to have them separate. getfolder() on a non-existent Maildir
fails and there might not be an equivalent local Maildir folder for a
filtered out IMAP folder.

Fix this by first checking if the remote folder should be filtered, and
only then retrieving the local folder (which should exist then).

This bug was found by our test suite!

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-09-01 03:12:16 +02:00
parent 49c11fc8f0
commit 3476e9ab36

View File

@ -312,12 +312,15 @@ class SyncableAccount(Account):
# check for CTRL-C or SIGTERM # check for CTRL-C or SIGTERM
if Account.abort_NOW_signal.is_set(): break if Account.abort_NOW_signal.is_set(): break
localfolder = self.get_local_folder(remotefolder) if not remotefolder.sync_this:
if not (remotefolder.sync_this
and localfolder.sync_this):
self.ui.debug('', "Not syncing filtered folder '%s'" self.ui.debug('', "Not syncing filtered folder '%s'"
"[%s]" % (remotefolder, remoterepos)) "[%s]" % (remotefolder, remoterepos))
continue # Ignore filtered folder continue # Ignore filtered folder
localfolder = self.get_local_folder(remotefolder)
if not localfolder.sync_this:
self.ui.debug('', "Not syncing filtered folder '%s'"
"[%s]" % (localfolder, localfolder.repository))
continue # Ignore filtered folder
thread = InstanceLimitedThread(\ thread = InstanceLimitedThread(\
instancename = 'FOLDER_' + self.remoterepos.getname(), instancename = 'FOLDER_' + self.remoterepos.getname(),
target = syncfolder, target = syncfolder,