fix: allow_dynoption
This commit is contained in:
parent
6f2f479364
commit
4bd1b8f04e
2 changed files with 12 additions and 4 deletions
|
|
@ -518,7 +518,7 @@ class _TiramisuOptionOptionDescription:
|
|||
and self._subconfig.option.impl_is_dynoptiondescription()
|
||||
)
|
||||
|
||||
@option_type(["option", "leadership"])
|
||||
@option_type(["option", "leadership", "allow_dynoption"])
|
||||
def leader(self):
|
||||
"""Get the leader option for a leadership or a follower option"""
|
||||
option = self._subconfig.option
|
||||
|
|
@ -640,7 +640,7 @@ class _TiramisuOptionOption(_TiramisuOptionOptionDescription):
|
|||
return self._subconfig.index
|
||||
return TiramisuOption(self._path, index, self._config_bag)
|
||||
|
||||
@option_type(["symlink", "optiondescription"])
|
||||
@option_type(["symlink", "optiondescription", "allow_dynoption"])
|
||||
def option(self, *args, **kwargs):
|
||||
"""For OptionDescription get sub option, for symlinkoption get the linked option"""
|
||||
if self._subconfig.option.impl_is_optiondescription():
|
||||
|
|
@ -1047,13 +1047,15 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
|
|||
return False
|
||||
return True
|
||||
|
||||
@option_type(["choice", "with_index"])
|
||||
@option_type(["choice", "with_index", "allow_dynoption"])
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
uncalculated: bool = False,
|
||||
):
|
||||
"""All values available for a ChoiceOption"""
|
||||
if self._subconfig.is_dynamic_without_identifiers and not uncalculated:
|
||||
raise AttributeOptionError(self._subconfig.path, "option-dynamic")
|
||||
return self._subconfig.option.impl_get_values(
|
||||
self._subconfig,
|
||||
uncalculated,
|
||||
|
|
@ -1215,7 +1217,7 @@ class TiramisuOption(
|
|||
self._set_subconfig()
|
||||
return self._subconfig.option.impl_get_group_type()
|
||||
|
||||
@option_type(["optiondescription", "validate_properties"])
|
||||
@option_type(["optiondescription", "validate_properties", "allow_dynoption"])
|
||||
def list(
|
||||
self,
|
||||
*,
|
||||
|
|
@ -1225,6 +1227,8 @@ class TiramisuOption(
|
|||
):
|
||||
"""List options inside an option description (by default list only option)"""
|
||||
self._set_subconfig()
|
||||
if self._subconfig.is_dynamic_without_identifiers and not uncalculated:
|
||||
raise AttributeOptionError(self._subconfig.path, "option-dynamic")
|
||||
return self._list(
|
||||
self._subconfig,
|
||||
validate_properties,
|
||||
|
|
|
|||
|
|
@ -426,6 +426,8 @@ class SubConfig:
|
|||
child,
|
||||
None,
|
||||
validate_properties,
|
||||
allow_dynoption=uncalculated,
|
||||
check_dynamic_without_identifiers=not uncalculated,
|
||||
)
|
||||
except PropertiesOptionError as err:
|
||||
if err.proptype in (["mandatory"], ["empty"]):
|
||||
|
|
@ -794,6 +796,8 @@ class _Config(CCache):
|
|||
name=name,
|
||||
identifier=identifier,
|
||||
true_path=true_path_,
|
||||
allow_dynoption=allow_dynoption,
|
||||
check_dynamic_without_identifiers=not allow_dynoption,
|
||||
)
|
||||
return subconfig
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue