Commit 3f577d7e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_slap_tool: decode before add to lxml.etree

   This prevent raise in case some non-ascii char is passed into the string.
parent 2c6ba47c
......@@ -119,14 +119,16 @@ def convertToREST(function):
def castToStr(dict_kw):
instance = etree.Element('instance')
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",
attrib={'id':_id}).text = str(_value)
attrib={'id': _id}).text = text.decode("utf-8")
return etree.tostring(instance, pretty_print=True,
xml_declaration=True, encoding='utf-8')
_MARKER = object()
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