diff options
| author | Sébastien Piquemal | 2012-02-07 13:15:30 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-07 13:15:30 +0200 |
| commit | ca96b4523b4c09489e4bfe726a894a5c6ada78aa (patch) | |
| tree | 7f9613e56b6ceb7f1c2760e2def3ec9114983430 /djangorestframework/parsers.py | |
| parent | a0dc0b10e53cd565b8264407769b6fd468a46230 (diff) | |
| download | django-rest-framework-ca96b4523b4c09489e4bfe726a894a5c6ada78aa.tar.bz2 | |
cleaned a bit Response/ResponseMixin code, added some documentation + renamed ErrorResponse to ImmediateResponse
Diffstat (limited to 'djangorestframework/parsers.py')
| -rw-r--r-- | djangorestframework/parsers.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index 7732a293..5fc5c71e 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -17,7 +17,7 @@ from django.http.multipartparser import MultiPartParserError from django.utils import simplejson as json from djangorestframework import status from djangorestframework.compat import yaml -from djangorestframework.response import ErrorResponse +from djangorestframework.response import ImmediateResponse from djangorestframework.utils.mediatypes import media_type_matches from xml.etree import ElementTree as ET import datetime @@ -88,7 +88,7 @@ class JSONParser(BaseParser): try: return (json.load(stream), None) except ValueError, exc: - raise ErrorResponse( + raise ImmediateResponse( content={'detail': 'JSON parse error - %s' % unicode(exc)}, status=status.HTTP_400_BAD_REQUEST) @@ -111,7 +111,7 @@ if yaml: try: return (yaml.safe_load(stream), None) except ValueError, exc: - raise ErrorResponse( + raise ImmediateResponse( content={'detail': 'YAML parse error - %s' % unicode(exc)}, status=status.HTTP_400_BAD_REQUEST) else: @@ -172,7 +172,7 @@ class MultiPartParser(BaseParser): try: django_parser = DjangoMultiPartParser(self.view.META, stream, upload_handlers) except MultiPartParserError, exc: - raise ErrorResponse( + raise ImmediateResponse( content={'detail': 'multipart parse error - %s' % unicode(exc)}, status=status.HTTP_400_BAD_REQUEST) return django_parser.parse() |
