mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Bugfix in config validator
This commit is contained in:
parent
a5eec6193b
commit
d33c98ac93
1 changed files with 11 additions and 5 deletions
|
|
@ -7,6 +7,7 @@ from click_threading import get_ui_worker
|
|||
|
||||
from . import cli_logger
|
||||
from .fetchparams import expand_fetch_params
|
||||
from .utils import storage_class_from_config
|
||||
from .. import PROJECT_HOME, exceptions
|
||||
from ..utils import expand_path
|
||||
|
||||
|
|
@ -287,11 +288,16 @@ class PairConfig(object):
|
|||
|
||||
def _set_partial_sync(self, options):
|
||||
partial_sync = options.pop('partial_sync', None)
|
||||
if partial_sync is not None and \
|
||||
not self.config_a.get('read_only', False) and \
|
||||
not self.config_b.get('read_only', False):
|
||||
raise ValueError('`partial_sync` is only effective if one storage '
|
||||
'is read-only.')
|
||||
if partial_sync is not None:
|
||||
cls_a, _ = storage_class_from_config(self.config_a)
|
||||
cls_b, _ = storage_class_from_config(self.config_b)
|
||||
|
||||
if not cls_a.read_only and \
|
||||
not self.config_a.get('read_only', False) and \
|
||||
not cls_b.read_only and \
|
||||
not self.config_b.get('read_only', False):
|
||||
raise ValueError('`partial_sync` is only effective if one '
|
||||
'storage is read-only.')
|
||||
|
||||
if partial_sync is None:
|
||||
partial_sync = 'revert'
|
||||
|
|
|
|||
Loading…
Reference in a new issue