Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
27d22cff
Commit
27d22cff
authored
Jan 11, 2012
by
Michele Lazzeri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "update author"
This reverts commit
f461acba
.
parent
ab83a2fa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
29 deletions
+2
-29
djangorestframework/parsers.py
+2
-29
No files found.
djangorestframework/parsers.py
View file @
27d22cff
...
...
@@ -189,38 +189,11 @@ class XMLParser(BaseParser):
"""
data
=
{}
tree
=
ET
.
parse
(
stream
)
data
=
self
.
_xml_convert
(
tree
.
getroot
())
for
child
in
tree
.
getroot
()
.
getchildren
():
data
[
child
.
tag
]
=
self
.
_type_convert
(
child
.
text
)
return
(
data
,
None
)
def
_xml_convert
(
self
,
element
):
"""
convert the xml `element` into the corresponding python object
`data` The python object representation of xml `element`.
"""
children
=
element
.
getchildren
()
if
len
(
children
)
==
0
:
return
self
.
_type_convert
(
element
.
text
)
else
:
if
element
.
tag
==
"resource"
:
data
=
[]
for
child
in
children
:
data
.
append
(
self
.
_xml_convert
(
child
))
else
:
if
children
[
0
]
.
tag
==
"resource"
:
data
=
[]
for
child
in
children
:
data
.
append
(
self
.
_xml_convert
(
child
))
else
:
data
=
{}
for
child
in
children
:
data
[
child
.
tag
]
=
self
.
_xml_convert
(
child
)
return
data
def
_type_convert
(
self
,
value
):
"""
Converts the value returned by the XMl parse into the equivalent
...
...
Write
Preview
Markdown
is supported
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