aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/views.py
diff options
context:
space:
mode:
authorTom Christie2012-08-25 13:27:55 +0100
committerTom Christie2012-08-25 13:27:55 +0100
commit26831df88e80feb815aeb3a2b8a7c275a71732e4 (patch)
treee31be3fd2847aa59974fae51334860cde6393458 /djangorestframework/views.py
parentaed26b218ea39110489e85abc6f412399a1774a1 (diff)
downloaddjango-rest-framework-26831df88e80feb815aeb3a2b8a7c275a71732e4.tar.bz2
Add ParseError (Removing ImmediateResponse)
Diffstat (limited to 'djangorestframework/views.py')
-rw-r--r--djangorestframework/views.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/djangorestframework/views.py b/djangorestframework/views.py
index be8f08ae..41be0337 100644
--- a/djangorestframework/views.py
+++ b/djangorestframework/views.py
@@ -13,7 +13,7 @@ from django.views.decorators.csrf import csrf_exempt
from djangorestframework.compat import View as DjangoView, apply_markdown
from djangorestframework.response import Response, ImmediateResponse
from djangorestframework.request import Request
-from djangorestframework import renderers, parsers, authentication, permissions, status
+from djangorestframework import renderers, parsers, authentication, permissions, status, exceptions
__all__ = (
@@ -249,6 +249,8 @@ class View(DjangoView):
except ImmediateResponse, exc:
response = exc.response
+ except exceptions.ParseError as exc:
+ response = Response({'detail': exc.detail}, status=status.HTTP_400_BAD_REQUEST)
self.response = self.final(request, response, *args, **kwargs)
return self.response