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
426547c6
Commit
426547c6
authored
Dec 17, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
str() -> six.text_type(). Closes #2290.
parent
65fc0d0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
rest_framework/exceptions.py
+2
-2
rest_framework/relations.py
+10
-8
No files found.
rest_framework/exceptions.py
View file @
426547c6
...
@@ -5,8 +5,8 @@ In addition Django's built in 403 and 404 exceptions are handled.
...
@@ -5,8 +5,8 @@ In addition Django's built in 403 and 404 exceptions are handled.
(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
(`django.http.Http404` and `django.core.exceptions.PermissionDenied`)
"""
"""
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.utils
import
six
from
django.utils.encoding
import
force_text
from
django.utils.encoding
import
force_text
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ungettext_lazy
from
django.utils.translation
import
ungettext_lazy
from
rest_framework
import
status
from
rest_framework
import
status
...
@@ -66,7 +66,7 @@ class ValidationError(APIException):
...
@@ -66,7 +66,7 @@ class ValidationError(APIException):
self
.
detail
=
_force_text_recursive
(
detail
)
self
.
detail
=
_force_text_recursive
(
detail
)
def
__str__
(
self
):
def
__str__
(
self
):
return
s
tr
(
self
.
detail
)
return
s
ix
.
text_type
(
self
.
detail
)
class
ParseError
(
APIException
):
class
ParseError
(
APIException
):
...
...
rest_framework/relations.py
View file @
426547c6
from
django.utils.encoding
import
smart_text
# coding: utf-8
from
rest_framework.fields
import
get_attribute
,
empty
,
Field
from
__future__
import
unicode_literals
from
rest_framework.reverse
import
reverse
from
rest_framework.utils
import
html
from
django.core.exceptions
import
ObjectDoesNotExist
,
ImproperlyConfigured
from
django.core.exceptions
import
ObjectDoesNotExist
,
ImproperlyConfigured
from
django.core.urlresolvers
import
resolve
,
get_script_prefix
,
NoReverseMatch
,
Resolver404
from
django.core.urlresolvers
import
resolve
,
get_script_prefix
,
NoReverseMatch
,
Resolver404
from
django.db.models.query
import
QuerySet
from
django.db.models.query
import
QuerySet
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.encoding
import
smart_text
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework.fields
import
get_attribute
,
empty
,
Field
from
rest_framework.reverse
import
reverse
from
rest_framework.utils
import
html
class
PKOnlyObject
(
object
):
class
PKOnlyObject
(
object
):
...
@@ -103,8 +105,8 @@ class RelatedField(Field):
...
@@ -103,8 +105,8 @@ class RelatedField(Field):
def
choices
(
self
):
def
choices
(
self
):
return
dict
([
return
dict
([
(
(
s
tr
(
self
.
to_representation
(
item
)),
s
ix
.
text_type
(
self
.
to_representation
(
item
)),
s
tr
(
item
)
s
ix
.
text_type
(
item
)
)
)
for
item
in
self
.
queryset
.
all
()
for
item
in
self
.
queryset
.
all
()
])
])
...
@@ -364,8 +366,8 @@ class ManyRelatedField(Field):
...
@@ -364,8 +366,8 @@ class ManyRelatedField(Field):
]
]
return
dict
([
return
dict
([
(
(
s
tr
(
item_representation
),
s
ix
.
text_type
(
item_representation
),
s
tr
(
item
)
+
' - '
+
str
(
item_representation
)
s
ix
.
text_type
(
item
)
+
' - '
+
six
.
text_type
(
item_representation
)
)
)
for
item
,
item_representation
in
items_and_representations
for
item
,
item_representation
in
items_and_representations
])
])
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