aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/response.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/response.py')
-rw-r--r--djangorestframework/response.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/djangorestframework/response.py b/djangorestframework/response.py
index c5fdccbc..6c42c898 100644
--- a/djangorestframework/response.py
+++ b/djangorestframework/response.py
@@ -75,7 +75,7 @@ class Response(SimpleTemplateResponse):
Returns reason text corresponding to our HTTP response status code.
Provided for convenience.
"""
- return STATUS_CODE_TEXT.get(self.status, '')
+ return STATUS_CODE_TEXT.get(self.status_code, '')
def _determine_accept_list(self):
"""
@@ -166,5 +166,11 @@ class ImmediateResponse(Response, BaseException):
"""
A subclass of :class:`Response` used to abort the current request handling.
"""
- pass
+ def __str__(self):
+ """
+ Since this class is also an exception it has to provide a sensible
+ representation for the cases when it is treated as an exception.
+ """
+ return ('%s must be caught in try/except block, '
+ 'and returned as a normal HttpResponse' % self.__class__.__name__)