fix: option.get now accept allow_dynoption

This commit is contained in:
egarette@silique.fr 2024-12-11 21:57:46 +01:00
parent 46a27e3a5c
commit 22fdabb6c0
2 changed files with 7 additions and 3 deletions

View file

@ -139,6 +139,8 @@ def option_type(typ):
@wraps(func) @wraps(func)
def wrapped(*args, **kwargs): def wrapped(*args, **kwargs):
self = args[0] self = args[0]
if isinstance(typ, list) and "allow_dynoption" in typ:
self._allow_dynoption = True
config_bag = self._config_bag config_bag = self._config_bag
if self._config_bag.context.impl_type == "group" and "group" in types: if self._config_bag.context.impl_type == "group" and "group" in types:
options_bag = [ options_bag = [
@ -269,10 +271,9 @@ class _TiramisuOptionWalk:
class _TiramisuOptionOptionDescription: class _TiramisuOptionOptionDescription:
"""Manage option""" """Manage option"""
_validate_properties = False _validate_properties = False
@option_type(["optiondescription", "option", "with_or_without_index", "symlink"]) @option_type(["optiondescription", "option", "with_or_without_index", "symlink", "allow_dynoption"])
def get(self): def get(self):
"""Get Tiramisu option""" """Get Tiramisu option"""
return self._subconfig.option return self._subconfig.option
@ -1527,7 +1528,7 @@ class TiramisuContextOption(TiramisuConfig, _TiramisuOptionWalk):
def get(self): def get(self):
"""Get Tiramisu option""" """Get Tiramisu option"""
return None return self._config_bag.context.get_description()
def isleadership(self): def isleadership(self):
"""Test if option is a leader or a follower""" """Test if option is a leader or a follower"""

View file

@ -602,6 +602,9 @@ def manager_callback(
"option {0} is not a dynoptiondescription or in a dynoptiondescription" "option {0} is not a dynoptiondescription or in a dynoptiondescription"
).format(display_name) ).format(display_name)
) )
if subconfig.identifiers is None:
# if uncalculated
return
return subconfig.identifiers[param.identifier_index] return subconfig.identifiers[param.identifier_index]
if isinstance(param, ParamSelfOption): if isinstance(param, ParamSelfOption):