[core] fix: filter attributes after the node upgrade

Values from removed attributes may be used in the node's upgrade code.
This commit is contained in:
Fabien Castan 2021-09-02 18:56:37 +02:00
parent 45bed69672
commit 290e0278e9

View file

@ -1369,7 +1369,8 @@ class CompatibilityNode(BaseNode):
commonInputs.append(attrName)
node = Node(self.nodeType, position=self.position)
attrValues = {key: value for key, value in self.inputs.items() if key in commonInputs}
# convert attributes from a list of tuples into a dict
attrValues = {key: value for (key, value) in self.inputs.items()}
# Use upgrade method of the node description itself if available
try:
@ -1382,6 +1383,8 @@ class CompatibilityNode(BaseNode):
logging.error("Error in the upgrade implementation of the node: {}. The return type is incorrect.".format(self.name))
upgradedAttrValues = attrValues
upgradedAttrValuesTmp = {key: value for (key, value) in upgradedAttrValues.items() if key in commonInputs}
node.upgradeAttributeValues(upgradedAttrValues)
return node