@@ -50,10 +50,7 @@ class JSONParser(BaseParser):
50
50
51
51
def parse (self , stream , media_type = None , parser_context = None ):
52
52
"""
53
- Returns a 2-tuple of `(data, files)`.
54
-
55
- `data` will be an object which is the parsed content of the response.
56
- `files` will always be `None`.
53
+ Parses the incoming bytestream as JSON and returns the resulting data.
57
54
"""
58
55
parser_context = parser_context or {}
59
56
encoding = parser_context .get ('encoding' , settings .DEFAULT_CHARSET )
@@ -74,10 +71,7 @@ class YAMLParser(BaseParser):
74
71
75
72
def parse (self , stream , media_type = None , parser_context = None ):
76
73
"""
77
- Returns a 2-tuple of `(data, files)`.
78
-
79
- `data` will be an object which is the parsed content of the response.
80
- `files` will always be `None`.
74
+ Parses the incoming bytestream as YAML and returns the resulting data.
81
75
"""
82
76
assert yaml , 'YAMLParser requires pyyaml to be installed'
83
77
@@ -100,10 +94,8 @@ class FormParser(BaseParser):
100
94
101
95
def parse (self , stream , media_type = None , parser_context = None ):
102
96
"""
103
- Returns a 2-tuple of `(data, files)`.
104
-
105
- `data` will be a :class:`QueryDict` containing all the form parameters.
106
- `files` will always be :const:`None`.
97
+ Parses the incoming bytestream as a URL encoded form,
98
+ and returns the resulting QueryDict.
107
99
"""
108
100
parser_context = parser_context or {}
109
101
encoding = parser_context .get ('encoding' , settings .DEFAULT_CHARSET )
@@ -120,7 +112,8 @@ class MultiPartParser(BaseParser):
120
112
121
113
def parse (self , stream , media_type = None , parser_context = None ):
122
114
"""
123
- Returns a DataAndFiles object.
115
+ Parses the incoming bytestream as a multipart encoded form,
116
+ and returns a DataAndFiles object.
124
117
125
118
`.data` will be a `QueryDict` containing all the form parameters.
126
119
`.files` will be a `QueryDict` containing all the form files.
@@ -147,6 +140,9 @@ class XMLParser(BaseParser):
147
140
media_type = 'application/xml'
148
141
149
142
def parse (self , stream , media_type = None , parser_context = None ):
143
+ """
144
+ Parses the incoming bytestream as XML and returns the resulting data.
145
+ """
150
146
assert etree , 'XMLParser requires defusedxml to be installed'
151
147
152
148
parser_context = parser_context or {}
@@ -216,7 +212,8 @@ class FileUploadParser(BaseParser):
216
212
217
213
def parse (self , stream , media_type = None , parser_context = None ):
218
214
"""
219
- Returns a DataAndFiles object.
215
+ Treats the incoming bytestream as a raw file upload and returns
216
+ a `DateAndFiles` object.
220
217
221
218
`.data` will be None (we expect request body to be a file content).
222
219
`.files` will be a `QueryDict` containing one 'file' element.
0 commit comments