diff options
| author | Sébastien Piquemal | 2012-02-02 18:19:44 +0200 |
|---|---|---|
| committer | Sébastien Piquemal | 2012-02-02 18:19:44 +0200 |
| commit | 5bb6301b7f53e3815ab1a81a5fa38721dc95b113 (patch) | |
| tree | 27d53698a374ac62c4a3be41b23173775c92f207 /djangorestframework/parsers.py | |
| parent | 5f59d90645dfddc293bbbbc4ca9b4c3f3125b590 (diff) | |
| download | django-rest-framework-5bb6301b7f53e3815ab1a81a5fa38721dc95b113.tar.bz2 | |
Response as a subclass of HttpResponse - first draft, not quite there yet.
Diffstat (limited to 'djangorestframework/parsers.py')
| -rw-r--r-- | djangorestframework/parsers.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/djangorestframework/parsers.py b/djangorestframework/parsers.py index e56ea025..7732a293 100644 --- a/djangorestframework/parsers.py +++ b/djangorestframework/parsers.py @@ -88,8 +88,9 @@ class JSONParser(BaseParser): try: return (json.load(stream), None) except ValueError, exc: - raise ErrorResponse(status.HTTP_400_BAD_REQUEST, - {'detail': 'JSON parse error - %s' % unicode(exc)}) + raise ErrorResponse( + content={'detail': 'JSON parse error - %s' % unicode(exc)}, + status=status.HTTP_400_BAD_REQUEST) if yaml: @@ -110,8 +111,9 @@ if yaml: try: return (yaml.safe_load(stream), None) except ValueError, exc: - raise ErrorResponse(status.HTTP_400_BAD_REQUEST, - {'detail': 'YAML parse error - %s' % unicode(exc)}) + raise ErrorResponse( + content={'detail': 'YAML parse error - %s' % unicode(exc)}, + status=status.HTTP_400_BAD_REQUEST) else: YAMLParser = None @@ -170,8 +172,9 @@ class MultiPartParser(BaseParser): try: django_parser = DjangoMultiPartParser(self.view.META, stream, upload_handlers) except MultiPartParserError, exc: - raise ErrorResponse(status.HTTP_400_BAD_REQUEST, - {'detail': 'multipart parse error - %s' % unicode(exc)}) + raise ErrorResponse( + content={'detail': 'multipart parse error - %s' % unicode(exc)}, + status=status.HTTP_400_BAD_REQUEST) return django_parser.parse() |
