add value.get() to optiondescription (instead of value.dict())

This commit is contained in:
egarette@silique.fr 2023-11-15 21:41:04 +01:00
parent e45a1910d9
commit 0b1d1ef3f1

View file

@ -582,13 +582,16 @@ class TiramisuOptionValue(CommonTiramisuOption):
@option_type('optiondescription') @option_type('optiondescription')
def dict(self, options_bag: List[OptionBag]): def dict(self, options_bag: List[OptionBag]):
"""Dict with path as key and value""" """Obsolete: dict with path as key and value"""
return self._config_bag.context.make_dict(options_bag[-1]) return self._config_bag.context.make_dict(options_bag[-1])
@option_type(['option', 'symlink', 'with_index']) @option_type(['option', 'symlink', 'with_index', 'optiondescription'])
def get(self, def get(self,
options_bag: List[OptionBag], options_bag: List[OptionBag],
): ):
"""Get value"""
if options_bag[-1].option.impl_is_optiondescription():
return self._config_bag.context.make_dict(options_bag[-1])
return self._get(options_bag) return self._get(options_bag)
def _get(self, def _get(self,
@ -947,6 +950,14 @@ class TiramisuContextValue(TiramisuConfig):
) )
def dict(self): def dict(self):
"""Obsolete: dict with path as key and value"""
option_bag = OptionBag(self._config_bag.context.get_description(),
None,
self._config_bag,
)
return self._config_bag.context.make_dict(option_bag)
def get(self):
"""Dict with path as key and value""" """Dict with path as key and value"""
option_bag = OptionBag(self._config_bag.context.get_description(), option_bag = OptionBag(self._config_bag.context.get_description(),
None, None,