Commit 79587b80 authored by Alexandra Parker's avatar Alexandra Parker Committed by Georg Krause
Browse files

fix(subsonic): AttributeError when getting user profile

parent 971529ef
Pipeline #16336 failed with stages
in 11 minutes and 53 seconds
......@@ -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)
el = ET.Element(key)
el.text = str(obj)
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)
Fix an error in a Subsonic methods that return lists of numbers/strings like getUser
Supports Markdown
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