From 20be7fd8a15e4454b604cc1b188887ac6e9628e5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 27 Aug 2019 16:04:53 +0200 Subject: [PATCH] Don't add to variant-specific mapping if it's not variant-specific Otherwise we'll encounter that the variant name is None when serialising that subprofile. Contributes to issue CURA-6600. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index ac53564eaf..cbdec39054 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -245,6 +245,7 @@ class XmlMaterialProfile(InstanceContainer): variant_name = container.getMetaDataEntry("variant_name") if not variant_name: machine_container_map[definition_id] = container + continue variant_dict = {"variant_type": container.getMetaDataEntry("hardware_type", str(VariantType.NOZZLE)), "material_container": container} @@ -344,7 +345,7 @@ class XmlMaterialProfile(InstanceContainer): stream = io.BytesIO() tree = ET.ElementTree(root) # this makes sure that the XML header states encoding="utf-8" - tree.write(stream, encoding = "utf-8", xml_declaration=True) + tree.write(stream, encoding = "utf-8", xml_declaration = True) return stream.getvalue().decode("utf-8")