Skip to content

Commit

Permalink
use double quotes in user messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jakul committed Jan 7, 2015
1 parent 662a907 commit 9a42670
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rest_framework/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class NotFound(APIException):

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:
Expand All @@ -118,7 +118,7 @@ def __init__(self, detail=None, available_renderers=None):

class UnsupportedMediaType(APIException):
status_code = status.HTTP_415_UNSUPPORTED_MEDIA_TYPE
default_detail = _("Unsupported media type '{media_type}' in request.")
default_detail = _("Unsupported media type \"{media_type}\" in request.")

def __init__(self, media_type, detail=None):
if detail is not None:
Expand Down
2 changes: 1 addition & 1 deletion rest_framework/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ def __init__(self, regex, **kwargs):

class SlugField(CharField):
default_error_messages = {
'invalid': _("Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.")
'invalid': _("Enter a valid \"slug\" consisting of letters, numbers, underscores or hyphens.")
}

def __init__(self, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions rest_framework/generics.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def paginate_queryset(self, queryset):
if page == 'last':
page_number = paginator.num_pages
else:
raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string 'last'."))
raise NotFound(_("Choose a valid page number. Page numbers must be a whole number, or must be the string \"last\"."))

try:
page = paginator.page(page_number)
except InvalidPage as exc:
error_format = _("Invalid page ({page_number}): {message}.")
error_format = _("Invalid page \"{page_number}\": {message}.")
raise NotFound(error_format.format(
page_number=page_number, message=six.text_type(exc)
))
Expand Down
2 changes: 1 addition & 1 deletion rest_framework/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def to_representation(self, value):
class PrimaryKeyRelatedField(RelatedField):
default_error_messages = {
'required': _("This field is required."),
'does_not_exist': _("Invalid pk '{pk_value}' - object does not exist."),
'does_not_exist': _("Invalid pk \"{pk_value}\" - object does not exist."),
'incorrect_type': _("Incorrect type. Expected pk value, received {data_type}."),
}

Expand Down
2 changes: 1 addition & 1 deletion rest_framework/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AcceptHeaderVersioning(BaseVersioning):
Host: example.com
Accept: application/json; version=1.0
"""
invalid_version_message = _("Invalid version in 'Accept' header.")
invalid_version_message = _("Invalid version in \"Accept\" header.")

def determine_version(self, request, *args, **kwargs):
media_type = _MediaType(request.accepted_media_type)
Expand Down

0 comments on commit 9a42670

Please sign in to comment.