mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 00:04:16 +03:00
Bits of cleanup
This commit is contained in:
parent
728e92f06a
commit
09a445b257
|
@ -34,8 +34,8 @@ class DataAndFiles(object):
|
||||||
|
|
||||||
class BaseParser(object):
|
class BaseParser(object):
|
||||||
"""
|
"""
|
||||||
All parsers should extend :class:`BaseParser`, specifying a :attr:`media_type` attribute,
|
All parsers should extend `BaseParser`, specifying a `media_type`
|
||||||
and overriding the :meth:`parse` method.
|
attribute, and overriding the `.parse_stream()` method.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
media_type = None
|
media_type = None
|
||||||
|
@ -66,7 +66,7 @@ class BaseParser(object):
|
||||||
|
|
||||||
def parse_stream(self, stream, **opts):
|
def parse_stream(self, stream, **opts):
|
||||||
"""
|
"""
|
||||||
Given a *stream* to read from, return the deserialized output.
|
Given a stream to read from, return the deserialized output.
|
||||||
Should return parsed data, or a DataAndFiles object consisting of the
|
Should return parsed data, or a DataAndFiles object consisting of the
|
||||||
parsed data and files.
|
parsed data and files.
|
||||||
"""
|
"""
|
||||||
|
@ -234,16 +234,3 @@ class XMLParser(BaseParser):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_PARSERS = (
|
|
||||||
JSONParser,
|
|
||||||
FormParser,
|
|
||||||
MultiPartParser,
|
|
||||||
XMLParser
|
|
||||||
)
|
|
||||||
|
|
||||||
if yaml:
|
|
||||||
DEFAULT_PARSERS += (YAMLParser, )
|
|
||||||
else:
|
|
||||||
YAMLParser = None
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ DEFAULTS = {
|
||||||
'DEFAULT_PARSERS': (
|
'DEFAULT_PARSERS': (
|
||||||
'rest_framework.parsers.JSONParser',
|
'rest_framework.parsers.JSONParser',
|
||||||
'rest_framework.parsers.FormParser'
|
'rest_framework.parsers.FormParser'
|
||||||
|
'rest_framework.parsers.MultiPartParser'
|
||||||
),
|
),
|
||||||
'DEFAULT_AUTHENTICATION': (
|
'DEFAULT_AUTHENTICATION': (
|
||||||
'rest_framework.authentication.SessionAuthentication',
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user