From 2365267f35f2d120eaf9853f91b419d24abb67d9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 12 May 2017 17:08:47 +0200 Subject: [PATCH] Be robust against older specification version numbers 1.2 and lower didn't specify a version number. Assume that it was 1.2. We feed this through our translation function for form, mostly, because we know that the setting_version should be 0 then. Contributes to issue CURA-3427. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index d7a9f47836..197a7b778f 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -423,7 +423,10 @@ class XmlMaterialProfile(InstanceContainer): inherited = self._resolveInheritance(inherits.text) data = self._mergeXML(inherited, data) - meta_data["setting_version"] = self.xmlVersionToSettingVersion(data.attrib["version"]) + if "version" in data.attrib: + meta_data["setting_version"] = self.xmlVersionToSettingVersion(data.attrib["version"]) + else: + meta_data["setting_version"] = self.xmlVersionToSettingVersion("1.2") #1.2 and lower didn't have that version number there yet. metadata = data.iterfind("./um:metadata/*", self.__namespaces) for entry in metadata: tag_name = _tag_without_namespace(entry)