aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/exceptions.py
diff options
context:
space:
mode:
authorCraig Blaszczyk2015-01-07 12:01:11 +0000
committerCraig Blaszczyk2015-01-07 12:01:11 +0000
commit4c32083b8b59a50877633910055313dad7bb117e (patch)
tree4de7729161f512c7c14beaafc4a6f776ce772cc1 /rest_framework/exceptions.py
parentfe5d93c8cbc5f3a9b1b6715208c70f485be68bdf (diff)
downloaddjango-rest-framework-4c32083b8b59a50877633910055313dad7bb117e.tar.bz2
use double quotes for user visible strings; end user visible strings in full stops; add some missing translation tags
Diffstat (limited to 'rest_framework/exceptions.py')
-rw-r--r--rest_framework/exceptions.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py
index dfc57293..3ca8e538 100644
--- a/rest_framework/exceptions.py
+++ b/rest_framework/exceptions.py
@@ -35,7 +35,7 @@ class APIException(Exception):
Subclasses should provide `.status_code` and `.default_detail` properties.
"""
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
- default_detail = _('A server error occurred.')
+ default_detail = _("A server error occurred.")
def __init__(self, detail=None):
if detail is not None:
@@ -52,7 +52,7 @@ class APIException(Exception):
# built in `ValidationError`. For example:
#
# from rest_framework import serializers
-# raise serializers.ValidationError('Value was invalid')
+# raise serializers.ValidationError("Value was invalid")
class ValidationError(APIException):
status_code = status.HTTP_400_BAD_REQUEST
@@ -70,32 +70,32 @@ class ValidationError(APIException):
class ParseError(APIException):
status_code = status.HTTP_400_BAD_REQUEST
- default_detail = _('Malformed request.')
+ default_detail = _("Malformed request.")
class AuthenticationFailed(APIException):
status_code = status.HTTP_401_UNAUTHORIZED
- default_detail = _('Incorrect authentication credentials.')
+ default_detail = _("Incorrect authentication credentials.")
class NotAuthenticated(APIException):
status_code = status.HTTP_401_UNAUTHORIZED
- default_detail = _('Authentication credentials were not provided.')
+ default_detail = _("Authentication credentials were not provided.")
class PermissionDenied(APIException):
status_code = status.HTTP_403_FORBIDDEN
- default_detail = _('You do not have permission to perform this action.')
+ default_detail = _("You do not have permission to perform this action.")
class NotFound(APIException):
status_code = status.HTTP_404_NOT_FOUND
- default_detail = _('Not found.')
+ default_detail = _("Not found.")
class MethodNotAllowed(APIException):
status_code = status.HTTP_405_METHOD_NOT_ALLOWED
- default_detail = _("Method {method} not allowed.")
+ default_detail = _("Method '{method}' not allowed.")
def __init__(self, method, detail=None):
if detail is not None:
@@ -106,7 +106,7 @@ class MethodNotAllowed(APIException):
class NotAcceptable(APIException):
status_code = status.HTTP_406_NOT_ACCEPTABLE
- default_detail = _('Could not satisfy the request Accept header.')
+ default_detail = _("Could not satisfy the request Accept header.")
def __init__(self, detail=None, available_renderers=None):
if detail is not None:
@@ -131,9 +131,9 @@ class UnsupportedMediaType(APIException):
class Throttled(APIException):
status_code = status.HTTP_429_TOO_MANY_REQUESTS
- default_detail = _('Request was throttled.')
- extra_detail_singular = 'Expected available in {wait} second.'
- extra_detail_plural = 'Expected available in {wait} seconds.'
+ default_detail = _("Request was throttled.")
+ extra_detail_singular = "Expected available in {wait} second."
+ extra_detail_plural = "Expected available in {wait} seconds."
def __init__(self, wait=None, detail=None):
if detail is not None: