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
00752dcd
Commit
00752dcd
authored
Feb 01, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3k cleanup
parent
f4f237e3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
16 deletions
+19
-16
.travis.yml
+7
-4
README.md
+1
-1
docs/index.md
+1
-1
rest_framework/compat.py
+2
-2
rest_framework/request.py
+4
-3
rest_framework/six.py
+0
-0
rest_framework/utils/mediatypes.py
+2
-1
tox.ini
+2
-4
No files found.
.travis.yml
View file @
00752dcd
...
@@ -4,18 +4,17 @@ python:
...
@@ -4,18 +4,17 @@ python:
-
"
2.6"
-
"
2.6"
-
"
2.7"
-
"
2.7"
-
"
3.2"
-
"
3.2"
-
"
3.3"
env
:
env
:
-
DJANGO=https://github.com/django/django/zipball/master
-
DJANGO=https://www.djangoproject.com/download/1.5c1/tarball/
-
DJANGO=https://www.djangoproject.com/download/1.5c1/tarball/
-
DJANGO="django==1.4.3 --use-mirrors"
-
DJANGO="django==1.4.3 --use-mirrors"
-
DJANGO="django==1.3.5 --use-mirrors"
-
DJANGO="django==1.3.5 --use-mirrors"
install
:
install
:
-
pip install $DJANGO
-
pip install $DJANGO
-
"
if
[[
$TRAVIS_PYTHON_VERSION
!=
'3.2'
]];
then
pip
install
django-filter==0.5.4
--use-mirrors;
fi"
-
"
if
[[
${TRAVIS_PYTHON_VERSION::1}
!=
'3'
]];
then
pip
install
django-filter==0.5.4
--use-mirrors;
fi"
-
"
if
[[
$TRAVIS_PYTHON_VERSION
==
'3.2'
]];
then
pip
install
https://github.com/alex/django-filter/tarball/master;
fi"
-
"
if
[[
${TRAVIS_PYTHON_VERSION::1}
==
'3'
]];
then
pip
install
https://github.com/alex/django-filter/tarball/master;
fi"
-
"
if
[[
$DJANGO
==
'django==1.3.5
--use-mirrors'
]];
then
pip
install
six
--use-mirrors;
fi"
-
export PYTHONPATH=.
-
export PYTHONPATH=.
script
:
script
:
...
@@ -27,3 +26,7 @@ matrix:
...
@@ -27,3 +26,7 @@ matrix:
env
:
DJANGO="django==1.4.3 --use-mirrors"
env
:
DJANGO="django==1.4.3 --use-mirrors"
-
python
:
"
3.2"
-
python
:
"
3.2"
env
:
DJANGO="django==1.3.5 --use-mirrors"
env
:
DJANGO="django==1.3.5 --use-mirrors"
-
python
:
"
3.3"
env
:
DJANGO="django==1.4.3 --use-mirrors"
-
python
:
"
3.3"
env
:
DJANGO="django==1.3.5 --use-mirrors"
README.md
View file @
00752dcd
...
@@ -28,7 +28,7 @@ There is also a sandbox API you can use for testing purposes, [available here][s
...
@@ -28,7 +28,7 @@ There is also a sandbox API you can use for testing purposes, [available here][s
# Requirements
# Requirements
*
Python (2.6, 2.7)
*
Python (2.6, 2.7
, 3.2, 3.3
)
*
Django (1.3, 1.4, 1.5)
*
Django (1.3, 1.4, 1.5)
**Optional:**
**Optional:**
...
...
docs/index.md
View file @
00752dcd
...
@@ -33,7 +33,7 @@ There is also a sandbox API you can use for testing purposes, [available here][s
...
@@ -33,7 +33,7 @@ There is also a sandbox API you can use for testing purposes, [available here][s
REST framework requires the following:
REST framework requires the following:
*
Python (2.6, 2.7)
*
Python (2.6, 2.7
, 3.2, 3.3
)
*
Django (1.3, 1.4, 1.5)
*
Django (1.3, 1.4, 1.5)
The following packages are optional:
The following packages are optional:
...
...
rest_framework/compat.py
View file @
00752dcd
...
@@ -7,11 +7,11 @@ from __future__ import unicode_literals
...
@@ -7,11 +7,11 @@ from __future__ import unicode_literals
import
django
import
django
# Try to import six from Django, fallback to
six itself (1.3.x)
# Try to import six from Django, fallback to
included `six`.
try
:
try
:
from
django.utils
import
six
from
django.utils
import
six
except
:
except
:
import
six
from
rest_framework
import
six
# location of patterns, url, include changes in 1.4 onwards
# location of patterns, url, include changes in 1.4 onwards
try
:
try
:
...
...
rest_framework/request.py
View file @
00752dcd
...
@@ -9,10 +9,11 @@ The wrapped request then offers a richer API, in particular :
...
@@ -9,10 +9,11 @@ The wrapped request then offers a richer API, in particular :
- full support of PUT method, including support for file uploads
- full support of PUT method, including support for file uploads
- form overloading of HTTP method, content type and content
- form overloading of HTTP method, content type and content
"""
"""
from
rest_framework.compat
import
BytesIO
from
django.http.multipartparser
import
parse_header
from
django.http.multipartparser
import
parse_header
from
rest_framework
import
HTTP_HEADER_ENCODING
from
rest_framework
import
exceptions
from
rest_framework
import
exceptions
from
rest_framework.compat
import
BytesIO
from
rest_framework.settings
import
api_settings
from
rest_framework.settings
import
api_settings
...
@@ -20,7 +21,7 @@ def is_form_media_type(media_type):
...
@@ -20,7 +21,7 @@ def is_form_media_type(media_type):
"""
"""
Return True if the media type is a valid form media type.
Return True if the media type is a valid form media type.
"""
"""
base_media_type
,
params
=
parse_header
(
media_type
.
encode
(
'iso-8859-1'
))
base_media_type
,
params
=
parse_header
(
media_type
.
encode
(
HTTP_HEADER_ENCODING
))
return
(
base_media_type
==
'application/x-www-form-urlencoded'
or
return
(
base_media_type
==
'application/x-www-form-urlencoded'
or
base_media_type
==
'multipart/form-data'
)
base_media_type
==
'multipart/form-data'
)
...
@@ -277,7 +278,7 @@ class Request(object):
...
@@ -277,7 +278,7 @@ class Request(object):
self
.
_CONTENT_PARAM
in
self
.
_data
and
self
.
_CONTENT_PARAM
in
self
.
_data
and
self
.
_CONTENTTYPE_PARAM
in
self
.
_data
):
self
.
_CONTENTTYPE_PARAM
in
self
.
_data
):
self
.
_content_type
=
self
.
_data
[
self
.
_CONTENTTYPE_PARAM
]
self
.
_content_type
=
self
.
_data
[
self
.
_CONTENTTYPE_PARAM
]
self
.
_stream
=
BytesIO
(
self
.
_data
[
self
.
_CONTENT_PARAM
]
.
encode
(
'iso-8859-1'
))
self
.
_stream
=
BytesIO
(
self
.
_data
[
self
.
_CONTENT_PARAM
]
.
encode
(
HTTP_HEADER_ENCODING
))
self
.
_data
,
self
.
_files
=
(
Empty
,
Empty
)
self
.
_data
,
self
.
_files
=
(
Empty
,
Empty
)
def
_parse
(
self
):
def
_parse
(
self
):
...
...
rest_framework/six.py
0 → 100644
View file @
00752dcd
This diff is collapsed.
Click to expand it.
rest_framework/utils/mediatypes.py
View file @
00752dcd
...
@@ -5,6 +5,7 @@ See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
...
@@ -5,6 +5,7 @@ See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
"""
"""
from
django.http.multipartparser
import
parse_header
from
django.http.multipartparser
import
parse_header
from
rest_framework
import
HTTP_HEADER_ENCODING
def
media_type_matches
(
lhs
,
rhs
):
def
media_type_matches
(
lhs
,
rhs
):
...
@@ -47,7 +48,7 @@ class _MediaType(object):
...
@@ -47,7 +48,7 @@ class _MediaType(object):
if
media_type_str
is
None
:
if
media_type_str
is
None
:
media_type_str
=
''
media_type_str
=
''
self
.
orig
=
media_type_str
self
.
orig
=
media_type_str
self
.
full_type
,
self
.
params
=
parse_header
(
media_type_str
.
encode
(
'iso-8859-1'
))
self
.
full_type
,
self
.
params
=
parse_header
(
media_type_str
.
encode
(
HTTP_HEADER_ENCODING
))
self
.
main_type
,
sep
,
self
.
sub_type
=
self
.
full_type
.
partition
(
'/'
)
self
.
main_type
,
sep
,
self
.
sub_type
=
self
.
full_type
.
partition
(
'/'
)
def
match
(
self
,
other
):
def
match
(
self
,
other
):
...
...
tox.ini
View file @
00752dcd
...
@@ -8,12 +8,12 @@ commands = {envpython} rest_framework/runtests/runtests.py
...
@@ -8,12 +8,12 @@ commands = {envpython} rest_framework/runtests/runtests.py
[testenv:py3.3-django1.5]
[testenv:py3.3-django1.5]
basepython
=
python3.3
basepython
=
python3.3
deps
=
https://www.djangoproject.com/download/1.5c1/tarball/
deps
=
https://www.djangoproject.com/download/1.5c1/tarball/
django-filter
=
=0.5.4
https://github.com/alex/django-filter/archive/master.tar.gz
[testenv:py3.2-django1.5]
[testenv:py3.2-django1.5]
basepython
=
python3.2
basepython
=
python3.2
deps
=
https://www.djangoproject.com/download/1.5c1/tarball/
deps
=
https://www.djangoproject.com/download/1.5c1/tarball/
django-filter
=
=0.5.4
https://github.com/alex/django-filter/archive/master.tar.gz
[testenv:py2.7-django1.5]
[testenv:py2.7-django1.5]
basepython
=
python2.7
basepython
=
python2.7
...
@@ -39,10 +39,8 @@ deps = django==1.4.3
...
@@ -39,10 +39,8 @@ deps = django==1.4.3
basepython
=
python2.7
basepython
=
python2.7
deps
=
django==1.3.5
deps
=
django==1.3.5
django-filter
=
=0.5.4
django-filter
=
=0.5.4
six
[testenv:py2.6-django1.3]
[testenv:py2.6-django1.3]
basepython
=
python2.6
basepython
=
python2.6
deps
=
django==1.3.5
deps
=
django==1.3.5
django-filter
=
=0.5.4
django-filter
=
=0.5.4
six
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