Commit 8a9a7912 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_slap_tool: decode before add to lxml.etree

See merge request nexedi/slapos.core!606
parents 2c6ba47c 3f577d7e
...@@ -119,14 +119,16 @@ def convertToREST(function): ...@@ -119,14 +119,16 @@ def convertToREST(function):
def castToStr(dict_kw): def castToStr(dict_kw):
instance = etree.Element('instance') instance = etree.Element('instance')
for _id, _value in dict_kw.iteritems(): for _id, _value in dict_kw.iteritems():
# cast everything to string # cast everything to string.
text = _value
if not isinstance(_value, str):
text = str(_value)
etree.SubElement(instance, "parameter", etree.SubElement(instance, "parameter",
attrib={'id':_id}).text = str(_value) attrib={'id': _id}).text = text.decode("utf-8")
return etree.tostring(instance, pretty_print=True, return etree.tostring(instance, pretty_print=True,
xml_declaration=True, encoding='utf-8') xml_declaration=True, encoding='utf-8')
_MARKER = object() _MARKER = object()
class SlapTool(BaseTool): class SlapTool(BaseTool):
......
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