dont change anything if config_error
This commit is contained in:
parent
57f4dd8d3f
commit
866364059c
|
@ -531,3 +531,14 @@ def test_callback_calculating_mandatory():
|
||||||
cfg = Config(maconfig)
|
cfg = Config(maconfig)
|
||||||
cfg.read_only()
|
cfg.read_only()
|
||||||
raises(ConfigError, 'cfg.od2.opt2')
|
raises(ConfigError, 'cfg.od2.opt2')
|
||||||
|
|
||||||
|
|
||||||
|
def test_callback_two_disabled_multi():
|
||||||
|
opt1 = BoolOption('opt1', '', properties=('disabled',))
|
||||||
|
opt2 = BoolOption('opt2', '', callback=return_value, callback_params={'': (('od1.opt1', False),)}, properties=('disabled',), multi=True)
|
||||||
|
od1 = OptionDescription('od1', '', [opt1])
|
||||||
|
od2 = OptionDescription('od2', '', [opt2])
|
||||||
|
maconfig = OptionDescription('rootconfig', '', [od1, od2])
|
||||||
|
cfg = Config(maconfig)
|
||||||
|
cfg.read_write()
|
||||||
|
raises(PropertiesOptionError, 'cfg.od2.opt2')
|
||||||
|
|
|
@ -213,10 +213,11 @@ class Values(object):
|
||||||
opt.impl_get_multitype() == multitypes.slave):
|
opt.impl_get_multitype() == multitypes.slave):
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
value = [value for i in range(lenmaster)]
|
value = [value for i in range(lenmaster)]
|
||||||
if opt.impl_is_multi():
|
if config_error is None:
|
||||||
value = Multi(value, self.context, opt, path, validate)
|
if opt.impl_is_multi():
|
||||||
# suppress value if already set
|
value = Multi(value, self.context, opt, path, validate)
|
||||||
self.reset(opt, path)
|
# suppress value if already set
|
||||||
|
self.reset(opt, path)
|
||||||
# frozen and force default
|
# frozen and force default
|
||||||
elif is_frozen and 'force_default_on_freeze' in setting[opt]:
|
elif is_frozen and 'force_default_on_freeze' in setting[opt]:
|
||||||
value = self._getdefault(opt)
|
value = self._getdefault(opt)
|
||||||
|
@ -224,9 +225,9 @@ class Values(object):
|
||||||
value = Multi(value, self.context, opt, path, validate)
|
value = Multi(value, self.context, opt, path, validate)
|
||||||
else:
|
else:
|
||||||
value = self._getvalue(opt, path, validate)
|
value = self._getvalue(opt, path, validate)
|
||||||
if validate:
|
if config_error is None and validate:
|
||||||
opt.impl_validate(value, self.context(), 'validator' in setting)
|
opt.impl_validate(value, self.context(), 'validator' in setting)
|
||||||
if self._is_default_owner(path) and \
|
if config_error is None and self._is_default_owner(path) and \
|
||||||
'force_store_value' in setting[opt]:
|
'force_store_value' in setting[opt]:
|
||||||
self.setitem(opt, value, path, is_write=False)
|
self.setitem(opt, value, path, is_write=False)
|
||||||
if validate_properties:
|
if validate_properties:
|
||||||
|
|
Loading…
Reference in New Issue