Fix repository 'readonly' configuration

The readonly feature was introduced to safeguard repositories from
accidental modifications. Unfortunately, my patch treated the readonly
setting as a string and not as a boolean, so if *anything* was set in
the configuration file as 'readonly', this value evaluated to True

Fortunately this was safe, we never treated a repository that we wanted
read-only as read-write. We always treated them readonly if something
was configured as "readonly=..." even if that was False.

The fix is simply to use getconfboolean() rather than getconf() which
checks for True/False/On/Off/yes/no/1/0 and hands back the correct boolean.

Reported-by: Tomasz Nowak <nowak2000@poczta.onet.pl>
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Sebastian Spaeth 2011-09-15 12:06:06 +02:00 committed by Nicolas Sebrecht
parent 7c83d505f8
commit fe57140224
1 changed files with 3 additions and 3 deletions

View File

@ -231,7 +231,7 @@ class SyncableAccount(Account):
localrepos = self.localrepos
statusrepos = self.statusrepos
# replicate the folderstructure from REMOTE to LOCAL
if not localrepos.getconf('readonly', False):
if not localrepos.getconfboolean('readonly', False):
self.ui.syncfolders(remoterepos, localrepos)
remoterepos.syncfoldersto(localrepos, statusrepos)
@ -345,7 +345,7 @@ def syncfolder(accountname, remoterepos, remotefolder, localrepos,
remotefolder.getmessagecount())
# Synchronize remote changes.
if not localrepos.getconf('readonly', False):
if not localrepos.getconfboolean('readonly', False):
ui.syncingmessages(remoterepos, remotefolder, localrepos, localfolder)
remotefolder.syncmessagesto(localfolder, statusfolder)
else:
@ -353,7 +353,7 @@ def syncfolder(accountname, remoterepos, remotefolder, localrepos,
% localrepos.getname())
# Synchronize local changes
if not remoterepos.getconf('readonly', False):
if not remoterepos.getconfboolean('readonly', False):
ui.syncingmessages(localrepos, localfolder, remoterepos, remotefolder)
localfolder.syncmessagesto(remotefolder, statusfolder)
else: