mandatory_warnings: PropertiesOptionError in optiondescription stop validate mandatory warnings for followers options

This commit is contained in:
Emmanuel Garette 2018-09-08 22:51:27 +02:00
parent aa9aef6e78
commit 7bfa6679e3
2 changed files with 10 additions and 8 deletions

View File

@ -12,6 +12,8 @@ from tiramisu.setting import groups
def make_description():
stro = StrOption('str', '')
subdescr = OptionDescription('sub', '', [stro], properties=('disabled',))
stroption = StrOption('str', 'Test string option', default="abc",
properties=('mandatory', ))
stroption1 = StrOption('str1', 'Test string option',
@ -22,7 +24,7 @@ def make_description():
properties=('mandatory', ))
stroption4 = StrOption('str4', 'Test string option', multi=True,
properties=('mandatory', ), allow_empty_list=True)
descr = OptionDescription('tiram', '', [stroption, stroption1, stroption2, stroption3, stroption4])
descr = OptionDescription('tiram', '', [subdescr, stroption, stroption1, stroption2, stroption3, stroption4])
return descr

View File

@ -537,7 +537,7 @@ class Values(object):
description,
currpath,
config,
od_setting_properties):
od_config_bag):
settings = context.cfgimpl_get_settings()
# for option in config.cfgimpl_get_children(self.config_bag):
for option in description.impl_getchildren(config_bag, context):
@ -545,26 +545,23 @@ class Values(object):
path = '.'.join(currpath + [name])
if option.impl_is_optiondescription():
ori_setting_properties = config_bag.properties
config_bag.properties = od_setting_properties
try:
option_bag = OptionBag()
option_bag.set_option(option,
path,
None,
config_bag)
od_config_bag)
subconfig = config.get_subconfig(name,
option_bag)
except PropertiesOptionError as err:
pass
else:
config_bag.properties = ori_setting_properties
for path in self._mandatory_warnings(context,
config_bag,
option,
currpath + [name],
subconfig,
od_setting_properties):
od_config_bag):
yield path
elif not option.impl_is_symlinkoption():
# don't verifying symlink
@ -610,6 +607,9 @@ class Values(object):
config_bag = ConfigBag(context=config_bag.context)
config_bag.properties = frozenset(setting_properties)
config_bag.set_permissive()
od_config_bag = ConfigBag(context=config_bag.context)
od_config_bag.properties = frozenset(od_setting_properties)
od_config_bag.set_permissive()
descr = context.cfgimpl_get_description()
return self._mandatory_warnings(context,
@ -617,4 +617,4 @@ class Values(object):
descr,
[],
context,
od_setting_properties)
od_config_bag)