Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Philipp Wolfer
funkwhale
Commits
79587b80
Commit
79587b80
authored
Sep 05, 2021
by
Alexandra Parker
Committed by
Georg Krause
Sep 05, 2021
Browse files
fix(subsonic): AttributeError when getting user profile
parent
971529ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
api/funkwhale_api/subsonic/renderers.py
View file @
79587b80
...
...
@@ -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
)
...
...
api/tests/subsonic/test_renderers.py
View file @
79587b80
...
...
@@ -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
)
...
...
changes/changelog.d/subsonic-attribute-error.bugfix
0 → 100644
View file @
79587b80
Fix an error in a Subsonic methods that return lists of numbers/strings like getUser
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment