fix: createfolders setting is ignored if readonly is True

If 'readonly' is True, folders shouldn't be created (regardless of
'createfolders' option). With old behavior, instead folders were always created
when 'readonly' is True (even if 'createfolders' was also False), which is a
serious bug (offlineimap was creating folders in all read-only repositories).
'createfolders' should only play a role if 'readonly' is False, in which case
folders should only be created if 'createfolders' is True.

Submitted-by: Vladimir Nesov <robotact@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Vladimir Nesov 2012-08-17 17:52:20 +00:00 committed by Nicolas Sebrecht
parent 44d2199a00
commit 6e5fbebc0e
2 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ ChangeLog
WIP (add new stuff for the next release) WIP (add new stuff for the next release)
======================================== ========================================
* Don't create folders if readonly is enabled.
* Learn to deal with readonly folders to properly detect this condition and act * Learn to deal with readonly folders to properly detect this condition and act
accordingly. One example is Gmail's "Chats" folder that is read-only, accordingly. One example is Gmail's "Chats" folder that is read-only,
but contains logs of the quick chats. (E. Ryabinkin) but contains logs of the quick chats. (E. Ryabinkin)

View File

@ -134,7 +134,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
It is disabled by either setting the whole repository It is disabled by either setting the whole repository
'readonly' or by using the 'createfolders' setting.""" 'readonly' or by using the 'createfolders' setting."""
return self._readonly or self.getconfboolean('createfolders', True) return (not self._readonly) and self.getconfboolean('createfolders', Tr
def makefolder(self, foldername): def makefolder(self, foldername):
"""Create a new folder""" """Create a new folder"""