aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTom Christie2015-01-31 08:53:40 +0000
committerTom Christie2015-01-31 08:53:40 +0000
commit2cc4cb24652366c6622af08370a0c04b429aa4b8 (patch)
tree2d02f7f5bf8dfb5274075b6f1d01551c0e249783 /rest_framework
parent6838f17325c2149e432e4a40b945695b765f35a2 (diff)
downloaddjango-rest-framework-2cc4cb24652366c6622af08370a0c04b429aa4b8.tar.bz2
Fix error text in test.
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/views.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/rest_framework/views.py b/rest_framework/views.py
index 995ddd0f..9445c840 100644
--- a/rest_framework/views.py
+++ b/rest_framework/views.py
@@ -4,6 +4,7 @@ Provides an APIView class that is the base of all views in REST framework.
from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.http import Http404
+from django.utils import six
from django.utils.encoding import smart_text
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
@@ -74,11 +75,13 @@ def exception_handler(exc, context):
return Response(data, status=exc.status_code, headers=headers)
elif isinstance(exc, Http404):
- data = {'detail': _('Not found.')}
+ msg = _('Not found.')
+ data = {'detail': six.text_type(msg)}
return Response(data, status=status.HTTP_404_NOT_FOUND)
elif isinstance(exc, PermissionDenied):
- data = {'detail': _('Permission denied.')}
+ msg = _('Permission denied.')
+ data = {'detail': six.text_type(msg)}
return Response(data, status=status.HTTP_403_FORBIDDEN)
# Note: Unhandled exceptions will raise a 500 error.