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
74fec7ee
Commit
74fec7ee
authored
Jan 28, 2014
by
Ian Foote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import force_bytes on django >= 1.5
parent
0383f11f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
rest_framework/compat.py
+1
-1
rest_framework/tests/test_compat.py
+13
-0
No files found.
rest_framework/compat.py
View file @
74fec7ee
...
...
@@ -457,7 +457,7 @@ from django.test.client import RequestFactory as DjangoRequestFactory
from
django.test.client
import
FakePayload
try
:
# In 1.5 the test client uses force_bytes
from
django.utils.encoding
import
force_bytes_or_smart_bytes
from
django.utils.encoding
import
force_bytes
as
force_bytes
_or_smart_bytes
except
ImportError
:
# In 1.3 and 1.4 the test client just uses smart_str
from
django.utils.encoding
import
smart_str
as
force_bytes_or_smart_bytes
...
...
rest_framework/tests/test_compat.py
0 → 100644
View file @
74fec7ee
import
django
from
django.test
import
TestCase
class
TestCompat
(
TestCase
):
def
test_force_bytes_or_smart_bytes
(
self
):
from
rest_framework.compat
import
force_bytes_or_smart_bytes
if
django
.
VERSION
>=
(
1
,
5
):
from
django.utils.encoding
import
force_bytes
self
.
assertEqual
(
force_bytes_or_smart_bytes
,
force_bytes
)
else
:
from
django.utils.encoding
import
smart_str
self
.
assertEqual
(
force_bytes_or_smart_bytes
,
smart_str
)
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