fix(subsonic): AttributeError when getting user profile
This commit is contained in:
parent
971529efee
commit
79587b801e
|
@ -75,7 +75,12 @@ def dict_to_xml_tree(root_tag, d, parent=None):
|
|||
root.append(dict_to_xml_tree(key, value, parent=root))
|
||||
elif isinstance(value, list):
|
||||
for obj in value:
|
||||
root.append(dict_to_xml_tree(key, obj, parent=root))
|
||||
if isinstance(obj, dict):
|
||||
el = dict_to_xml_tree(key, obj, parent=root)
|
||||
else:
|
||||
el = ET.Element(key)
|
||||
el.text = str(obj)
|
||||
root.append(el)
|
||||
else:
|
||||
if key == "value":
|
||||
root.text = str(value)
|
||||
|
|
|
@ -70,9 +70,10 @@ def test_xml_renderer_dict_to_xml():
|
|||
payload = {
|
||||
"hello": "world",
|
||||
"item": [{"this": 1, "value": "text"}, {"some": "node"}],
|
||||
"list": [1, 2],
|
||||
}
|
||||
expected = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<key hello="world"><item this="1">text</item><item some="node" /></key>"""
|
||||
<key hello="world"><item this="1">text</item><item some="node" /><list>1</list><list>2</list></key>"""
|
||||
result = renderers.dict_to_xml_tree("key", payload)
|
||||
exp = ET.fromstring(expected)
|
||||
assert ET.tostring(result) == ET.tostring(exp)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix an error in a Subsonic methods that return lists of numbers/strings like getUser
|
Loading…
Reference in New Issue