[core] Add support for lambda function in Attribute desc value

Allows to dynamically configure the default value of the Attribute in python.
This commit is contained in:
Fabien Castan 2020-06-28 16:01:18 +02:00
parent 05a93c28a2
commit bbc56cfb31
2 changed files with 7 additions and 3 deletions

View file

@ -583,8 +583,9 @@ class BaseNode(BaseObject):
if not isinstance(attr.attributeDesc, desc.File):
continue
attr.value = attr.attributeDesc.value.format(**self._cmdVars)
attr._invalidationValue = attr.attributeDesc.value.format(**cmdVarsNoCache)
defaultValue = attr.defaultValue()
attr.value = defaultValue.format(**self._cmdVars)
attr._invalidationValue = defaultValue.format(**cmdVarsNoCache)
v = attr.getValueStr()
self._cmdVars[name] = '--{name} {value}'.format(name=name, value=v)