Re-use stack variable

We're creating the variable but then requesting the 0th element from the list each time... That can be more logical and more efficient.

Contributes to issue CURA-4243.
This commit is contained in:
Ghostkeeper 2017-10-19 15:32:21 +02:00
parent 1a47ec85ca
commit 7745113704
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -651,13 +651,13 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# HACK # HACK
# There is a machine, check if it has authentication data. If so, keep that data. # There is a machine, check if it has authentication data. If so, keep that data.
network_authentication_id = container_stacks[0].getMetaDataEntry("network_authentication_id") network_authentication_id = stack.getMetaDataEntry("network_authentication_id")
network_authentication_key = container_stacks[0].getMetaDataEntry("network_authentication_key") network_authentication_key = stack.getMetaDataEntry("network_authentication_key")
container_stacks[0].deserialize(archive.open(global_stack_file).read().decode("utf-8")) stack.deserialize(archive.open(global_stack_file).read().decode("utf-8"))
if network_authentication_id: if network_authentication_id:
container_stacks[0].addMetaDataEntry("network_authentication_id", network_authentication_id) stack.addMetaDataEntry("network_authentication_id", network_authentication_id)
if network_authentication_key: if network_authentication_key:
container_stacks[0].addMetaDataEntry("network_authentication_key", network_authentication_key) stack.addMetaDataEntry("network_authentication_key", network_authentication_key)
elif self._resolve_strategies["machine"] == "new": elif self._resolve_strategies["machine"] == "new":
# create a new global stack # create a new global stack