remove warnings when execute option.list

This commit is contained in:
Emmanuel Garette 2018-11-17 23:02:03 +01:00
parent 17bd7c3c05
commit ef66d487b7
2 changed files with 17 additions and 8 deletions

View file

@ -1003,14 +1003,15 @@ class TiramisuContextOption(TiramisuContext):
def _filter(self, def _filter(self,
opt, opt,
subconfig): subconfig,
config_bag):
option_bag = OptionBag() option_bag = OptionBag()
option_bag.set_option(opt, option_bag.set_option(opt,
opt.impl_getpath(), opt.impl_getpath(),
None, None,
self._config_bag) config_bag)
if opt.impl_is_optiondescription(): if opt.impl_is_optiondescription():
self._config_bag.context.cfgimpl_get_settings().validate_properties(option_bag) config_bag.context.cfgimpl_get_settings().validate_properties(option_bag)
return subconfig.get_subconfig(option_bag) return subconfig.get_subconfig(option_bag)
subconfig.getattr(opt.impl_getname(), subconfig.getattr(opt.impl_getname(),
option_bag) option_bag)
@ -1020,11 +1021,13 @@ class TiramisuContextOption(TiramisuContext):
recursive, recursive,
type_, type_,
group_type, group_type,
config_bag,
subconfig): subconfig):
for opt in option.get_children(self._config_bag): for opt in option.get_children(config_bag):
try: try:
subsubconfig = self._filter(opt, subsubconfig = self._filter(opt,
subconfig) subconfig,
config_bag)
except PropertiesOptionError: except PropertiesOptionError:
continue continue
if opt.impl_is_optiondescription(): if opt.impl_is_optiondescription():
@ -1033,6 +1036,7 @@ class TiramisuContextOption(TiramisuContext):
recursive, recursive,
type_, type_,
group_type, group_type,
config_bag,
subsubconfig): subsubconfig):
yield toption yield toption
if type_ == 'option' or (type_ == 'optiondescription' and \ if type_ == 'option' or (type_ == 'optiondescription' and \
@ -1056,12 +1060,17 @@ class TiramisuContextOption(TiramisuContext):
assert type in ('all', 'option', 'optiondescription'), _('unknown list type {}').format(type) assert type in ('all', 'option', 'optiondescription'), _('unknown list type {}').format(type)
assert group_type is None or isinstance(group_type, groups.GroupType), \ assert group_type is None or isinstance(group_type, groups.GroupType), \
_("unknown group_type: {0}").format(group_type) _("unknown group_type: {0}").format(group_type)
option = self._config_bag.context.cfgimpl_get_description() config_bag = self._config_bag
if config_bag.properties and 'warnings' in config_bag.properties:
config_bag = config_bag.copy()
config_bag.properties = config_bag.properties - {'warnings'}
option = config_bag.context.cfgimpl_get_description()
for toption in self._walk(option, for toption in self._walk(option,
recursive, recursive,
type, type,
group_type, group_type,
self._config_bag.context): config_bag,
config_bag.context):
yield toption yield toption

View file

@ -28,7 +28,7 @@ from .option import SynDynOptionDescription, DynOptionDescription, MasterSlaves
from .option.baseoption import BaseOption, valid_name from .option.baseoption import BaseOption, valid_name
from .setting import OptionBag, ConfigBag, groups, Settings, undefined from .setting import OptionBag, ConfigBag, groups, Settings, undefined
from .storage import get_storages, gen_storage_id, get_default_values_storages from .storage import get_storages, gen_storage_id, get_default_values_storages
from .value import Values # , Multi from .value import Values
from .i18n import _ from .i18n import _