Convert all metadata fields to string

The XML builder expects string, strictly. Only None is handled separately.

Contributes to issue CURA-3808.
This commit is contained in:
Ghostkeeper 2017-05-15 09:37:29 +02:00
parent f4f6be103e
commit c48017e174
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -159,10 +159,10 @@ class XmlMaterialProfile(InstanceContainer):
for key, value in metadata.items():
builder.start(key)
# Normally value is a string.
# Nones get handled well.
if isinstance(value, bool):
value = str(value) # parseBool in deserialize expects 'True'.
if value is not None: #Nones get handled well by the builder.
#Otherwise the builder always expects a string.
#Deserialize expects the stringified version.
value = str(value)
builder.data(value)
builder.end(key)