8000 Fix error text in test. · coderanger/django-rest-framework@2cc4cb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2cc4cb2

Browse files
committed
Fix error text in test.
1 parent 6838f17 commit 2cc4cb2

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

docs/topics/3.1-announcement.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
#### Pagination controls in the browsable API.
66

7-
#### New pagination schemes.
7+
#### New schemes, including cursor pagination.
88

99
#### Support for header-based pagination.
1010

1111
## Versioning
1212

1313
## Internationalization
1414

15+
## New fields
16+
1517
## ModelSerializer API

rest_framework/views.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from __future__ import unicode_literals
55
from django.core.exceptions import PermissionDenied
66
from django.http import Http404
7+
from django.utils import six
78
from django.utils.encoding import smart_text
89
from django.utils.translation import ugettext_lazy as _
910
from django.views.decorators.csrf import csrf_exempt
@@ -74,11 +75,13 @@ def exception_handler(exc, context):
7475
return Response(data, status=exc.status_code, headers=headers)
7576

7677
elif isinstance(exc, Http404):
77-
data = {'detail': _('Not found.')}
78+
msg = _('Not found.')
79+
data = {'detail': six.text_type(msg)}
7880
return Response(data, status=status.HTTP_404_NOT_FOUND)
7981

8082
elif isinstance(exc, PermissionDenied):
81-
data = {'detail': _('Permission denied.')}
83+
msg = _('Permission denied.')
84+
data = {'detail': six.text_type(msg)}
8285
return Response(data, status=status.HTTP_403_FORBIDDEN)
8386

8487
# Note: Unhandled exceptions will raise a 500 error.

tests/test_generics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def test_get_instance_view_filters_out_name_with_filter_backend(self):
483483
request = factory.get('/1')
484484
response = instance_view(request, pk=1).render()
485485
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
486-
self.assertEqual(response.data, {'detail': 'Not found'})
486+
self.assertEqual(response.data, {'detail': 'Not found.'})
487487

488488
def test_get_instance_view_will_return_single_object_when_filter_does_not_exclude_it(self):
489489
"""
< 30A1 h2 class="sr-only">0 commit comments
Comments
 (0)
0