From 327a38380545fd2e7c979262991183a1cd871ff9 Mon Sep 17 00:00:00 2001 From: dzil123 <5725958+dzil123@users.noreply.github.com> Date: Wed, 27 Nov 2019 23:44:37 -0800 Subject: [PATCH] B: Still save nodetree as json when no import because non-sideeffected --- opsi/webserver/serialize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opsi/webserver/serialize.py b/opsi/webserver/serialize.py index 07eadeb..39d0044 100644 --- a/opsi/webserver/serialize.py +++ b/opsi/webserver/serialize.py @@ -384,7 +384,9 @@ def _remove_unneeded_nodes(program, nodetree: NodeTreeN): # Finally, remove those nodes that weren't visited nodes = [node for node in nodetree.nodes if node.id in visited] - nodetree.nodes = nodes + + # make a copy of nodetree to fix broken json save + nodetree = NodeTreeN(nodes=nodes) return nodetree