aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/parsers.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/parsers.py')
-rw-r--r--djangorestframework/parsers.py48
1 files changed, 0 insertions, 48 deletions
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py
index 03f8bf8f..96b29a66 100644
--- a/djangorestframework/parsers.py
+++ b/djangorestframework/parsers.py
@@ -11,60 +11,12 @@ We need a method to be able to:
from django.http.multipartparser import MultiPartParser as DjangoMPParser
from django.utils import simplejson as json
-<<<<<<< local
from djangorestframework.response import ErrorResponse
-=======
-from djangorestframework.response import ResponseException
->>>>>>> other
from djangorestframework import status
from djangorestframework.utils import as_tuple
from djangorestframework.mediatypes import MediaType
from djangorestframework.compat import parse_qs
-<<<<<<< local
-=======
-try:
- from urlparse import parse_qs
-except ImportError:
- from cgi import parse_qs
-
-class ParserMixin(object):
- parsers = ()
-
- def parse(self, stream, content_type):
- """
- Parse the request content.
-
- May raise a 415 ResponseException (Unsupported Media Type),
- or a 400 ResponseException (Bad Request).
- """
- parsers = as_tuple(self.parsers)
-
- parser = None
- for parser_cls in parsers:
- if parser_cls.handles(content_type):
- parser = parser_cls(self)
- break
-
- if parser is None:
- raise ResponseException(status.HTTP_415_UNSUPPORTED_MEDIA_TYPE,
- {'error': 'Unsupported media type in request \'%s\'.' %
- content_type.media_type})
-
- return parser.parse(stream)
-
- @property
- def parsed_media_types(self):
- """Return an list of all the media types that this ParserMixin can parse."""
- return [parser.media_type for parser in self.parsers]
-
- @property
- def default_parser(self):
- """Return the ParerMixin's most prefered emitter.
- (This has no behavioural effect, but is may be used by documenting emitters)"""
- return self.parsers[0]
->>>>>>> other
-
class BaseParser(object):
"""All parsers should extend BaseParser, specifying a media_type attribute,