dont change anything if config_error

This commit is contained in:
Emmanuel Garette 2013-09-17 09:10:08 +02:00
parent 57f4dd8d3f
commit 866364059c
2 changed files with 18 additions and 6 deletions

View File

@ -531,3 +531,14 @@ def test_callback_calculating_mandatory():
cfg = Config(maconfig)
cfg.read_only()
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')

View File

@ -213,6 +213,7 @@ class Values(object):
opt.impl_get_multitype() == multitypes.slave):
if not isinstance(value, list):
value = [value for i in range(lenmaster)]
if config_error is None:
if opt.impl_is_multi():
value = Multi(value, self.context, opt, path, validate)
# suppress value if already set
@ -224,9 +225,9 @@ class Values(object):
value = Multi(value, self.context, opt, path, validate)
else:
value = self._getvalue(opt, path, validate)
if validate:
if config_error is None and validate:
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]:
self.setitem(opt, value, path, is_write=False)
if validate_properties: