Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
9a426704
Commit
9a426704
authored
Jan 07, 2015
by
Craig Blaszczyk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use double quotes in user messages
parent
662a907b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
7 deletions
+7
-7
rest_framework/exceptions.py
+2
-2
rest_framework/fields.py
+1
-1
rest_framework/generics.py
+2
-2
rest_framework/relations.py
+1
-1
rest_framework/versioning.py
+1
-1
No files found.
rest_framework/exceptions.py
View file @
9a426704
...
...
@@ -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
:
...
...
@@ -118,7 +118,7 @@ class NotAcceptable(APIException):
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
:
...
...
rest_framework/fields.py
View file @
9a426704
...
...
@@ -612,7 +612,7 @@ class RegexField(CharField):
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
):
...
...
rest_framework/generics.py
View file @
9a426704
...
...
@@ -120,12 +120,12 @@ class GenericAPIView(views.APIView):
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
)
))
...
...
rest_framework/relations.py
View file @
9a426704
...
...
@@ -129,7 +129,7 @@ class StringRelatedField(RelatedField):
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}."
),
}
...
...
rest_framework/versioning.py
View file @
9a426704
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment