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
5fa10024
Commit
5fa10024
authored
Jul 04, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update parser docstrings. Closes #968.
parent
0950d3e0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
rest_framework/parsers.py
+11
-14
No files found.
rest_framework/parsers.py
View file @
5fa10024
...
...
@@ -50,10 +50,7 @@ class JSONParser(BaseParser):
def
parse
(
self
,
stream
,
media_type
=
None
,
parser_context
=
None
):
"""
Returns a 2-tuple of `(data, files)`.
`data` will be an object which is the parsed content of the response.
`files` will always be `None`.
Parses the incoming bytestream as JSON and returns the resulting data.
"""
parser_context
=
parser_context
or
{}
encoding
=
parser_context
.
get
(
'encoding'
,
settings
.
DEFAULT_CHARSET
)
...
...
@@ -74,10 +71,7 @@ class YAMLParser(BaseParser):
def
parse
(
self
,
stream
,
media_type
=
None
,
parser_context
=
None
):
"""
Returns a 2-tuple of `(data, files)`.
`data` will be an object which is the parsed content of the response.
`files` will always be `None`.
Parses the incoming bytestream as YAML and returns the resulting data.
"""
assert
yaml
,
'YAMLParser requires pyyaml to be installed'
...
...
@@ -100,10 +94,8 @@ class FormParser(BaseParser):
def
parse
(
self
,
stream
,
media_type
=
None
,
parser_context
=
None
):
"""
Returns a 2-tuple of `(data, files)`.
`data` will be a :class:`QueryDict` containing all the form parameters.
`files` will always be :const:`None`.
Parses the incoming bytestream as a URL encoded form,
and returns the resulting QueryDict.
"""
parser_context
=
parser_context
or
{}
encoding
=
parser_context
.
get
(
'encoding'
,
settings
.
DEFAULT_CHARSET
)
...
...
@@ -120,7 +112,8 @@ class MultiPartParser(BaseParser):
def
parse
(
self
,
stream
,
media_type
=
None
,
parser_context
=
None
):
"""
Returns a DataAndFiles object.
Parses the incoming bytestream as a multipart encoded form,
and returns a DataAndFiles object.
`.data` will be a `QueryDict` containing all the form parameters.
`.files` will be a `QueryDict` containing all the form files.
...
...
@@ -147,6 +140,9 @@ class XMLParser(BaseParser):
media_type
=
'application/xml'
def
parse
(
self
,
stream
,
media_type
=
None
,
parser_context
=
None
):
"""
Parses the incoming bytestream as XML and returns the resulting data.
"""
assert
etree
,
'XMLParser requires defusedxml to be installed'
parser_context
=
parser_context
or
{}
...
...
@@ -216,7 +212,8 @@ class FileUploadParser(BaseParser):
def
parse
(
self
,
stream
,
media_type
=
None
,
parser_context
=
None
):
"""
Returns a DataAndFiles object.
Treats the incoming bytestream as a raw file upload and returns
a `DateAndFiles` object.
`.data` will be None (we expect request body to be a file content).
`.files` will be a `QueryDict` containing one 'file' element.
...
...
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