fix: secret with follower
This commit is contained in:
parent
f9c73783c5
commit
7027aaefd4
3 changed files with 16 additions and 8 deletions
|
|
@ -242,7 +242,7 @@ class Annotator(Walk): # pylint: disable=R0903
|
|||
if calculated_variable.multi is None:
|
||||
if (
|
||||
isinstance(calculated_variable.default, VariableCalculation)
|
||||
and variable.path == calculated_variable.default.path
|
||||
and variable.path == calculated_variable.default.variable
|
||||
):
|
||||
msg = _(
|
||||
'the "{0}" default value is a calculation with itself'
|
||||
|
|
|
|||
|
|
@ -586,7 +586,6 @@ def _rougail_config(
|
|||
|
||||
tiram_obj = convert.save()
|
||||
optiondescription = {}
|
||||
print(tiram_obj)
|
||||
exec(tiram_obj, {}, optiondescription) # pylint: disable=W0122
|
||||
return optiondescription["option_0"], extra_vars
|
||||
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ class UserData:
|
|||
for idx in range(len_leader - 1, -1, -1):
|
||||
option.value.pop(idx)
|
||||
try:
|
||||
self.set_value(option, value, options)
|
||||
self.set_value(option, value, options, index)
|
||||
value_is_set = True
|
||||
except Exception as err:
|
||||
if path != option.path():
|
||||
|
|
@ -398,19 +398,24 @@ class UserData:
|
|||
path, option, self.values[path].get("options", {}), value
|
||||
)
|
||||
if option.isfollower():
|
||||
indexes = range(len(value))
|
||||
if not isinstance(value, tuple):
|
||||
indexes = range(len(value))
|
||||
else:
|
||||
indexes = range(len(option.parent().leader().value.get()))
|
||||
values = value
|
||||
else:
|
||||
indexes = [None]
|
||||
for index in indexes:
|
||||
try:
|
||||
if option.isfollower():
|
||||
value = values[index]
|
||||
if not isinstance(value, tuple):
|
||||
value = values[index]
|
||||
if value is undefined or isinstance(value, CancelParam):
|
||||
continue
|
||||
option.index(index).value.set(value)
|
||||
index_ = index
|
||||
else:
|
||||
self.set_value(option, value, options.get("options", {}))
|
||||
index_ = None
|
||||
self.set_value(option, value, options.get("options", {}), index_)
|
||||
except PropertiesOptionError as err:
|
||||
if err.code == "property-error":
|
||||
properties = display_list(
|
||||
|
|
@ -537,15 +542,19 @@ class UserData:
|
|||
continue
|
||||
raise err from err
|
||||
|
||||
def set_value(self, option, value, options):
|
||||
def set_value(self, option, value, options, index):
|
||||
is_secret_manager = options.get("secret_manager", False)
|
||||
if is_secret_manager and isinstance(value, tuple):
|
||||
# it's a function
|
||||
params = tuple([ParamValue(val) for val in value[1:]])
|
||||
if index is not None:
|
||||
option = option.forcepermissive.index(index)
|
||||
value = Calculation(value[0], Params(params, kwargs={"option": ParamValue(option)}))
|
||||
option = option.forcepermissive
|
||||
add_validation = True
|
||||
else:
|
||||
if index is not None:
|
||||
option = option.index(index)
|
||||
add_validation = False
|
||||
option.value.set(value)
|
||||
if add_validation:
|
||||
|
|
|
|||
Loading…
Reference in a new issue