Commit b8bd51d8 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪 Committed by Julien Muchembled

slapproxy: fix support of non-string (e.g. int) values in requests

This fixes a regression introduced in commit 7467ef4c
("Add Python 3 support").

/reviewed-on nexedi/slapos.core!98
parent 7eadf62c
...@@ -69,9 +69,11 @@ def xml2dict(xml): ...@@ -69,9 +69,11 @@ def xml2dict(xml):
def dict2xml(dictionary): def dict2xml(dictionary):
instance = etree.Element('instance') instance = etree.Element('instance')
for parameter_id, parameter_value in six.iteritems(dictionary): for k, v in six.iteritems(dictionary):
if not isinstance(v, six.string_types):
v = str(v)
etree.SubElement(instance, "parameter", etree.SubElement(instance, "parameter",
attrib={'id': parameter_id}).text = parameter_value attrib={'id': k}).text = v
return bytes2str(etree.tostring(instance, return bytes2str(etree.tostring(instance,
pretty_print=True, pretty_print=True,
xml_declaration=True, xml_declaration=True,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment