aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2014-08-19 17:06:55 +0100
committerTom Christie2014-08-19 17:06:55 +0100
commit63d02dbea855a060ec4cdb194497188e2f40cb66 (patch)
tree6b928af2fb99cabf486bc15079db3cd831d8bf34
parent00c0dfc66fd2426a63e6eec498395740b2c3e63b (diff)
downloaddjango-rest-framework-63d02dbea855a060ec4cdb194497188e2f40cb66.tar.bz2
Drop six from compat. 1.4.2 is now the lowest supported version.
-rw-r--r--README.md2
-rw-r--r--docs/index.md2
-rw-r--r--docs/topics/2.4-accouncement.md1
-rw-r--r--rest_framework/compat.py7
-rw-r--r--rest_framework/decorators.py2
-rw-r--r--rest_framework/fields.py4
-rw-r--r--rest_framework/filters.py3
-rw-r--r--rest_framework/parsers.py3
-rw-r--r--rest_framework/renderers.py6
-rw-r--r--rest_framework/response.py2
-rw-r--r--rest_framework/serializers.py2
-rw-r--r--rest_framework/settings.py5
-rw-r--r--rest_framework/templatetags/rest_framework.py3
-rw-r--r--rest_framework/test.py3
-rw-r--r--tests/test_authentication.py3
-rw-r--r--tests/test_files.py2
-rw-r--r--tests/test_generics.py2
-rw-r--r--tests/test_htmlrenderer.py4
-rw-r--r--tests/test_relations_pk.py2
-rw-r--r--tests/test_renderers.py4
-rw-r--r--tests/test_request.py2
-rw-r--r--tests/test_response.py2
-rw-r--r--tests/test_serializers.py2
-rw-r--r--tests/utils.py2
24 files changed, 31 insertions, 39 deletions
diff --git a/README.md b/README.md
index 0eaf5c83..7052ab63 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,7 @@ There is a live example API for testing purposes, [available here][sandbox].
# Requirements
* Python (2.6.5+, 2.7, 3.2, 3.3)
-* Django (1.3, 1.4, 1.5, 1.6)
+* Django (1.4.2+, 1.5, 1.6, 1.7)
# Installation
diff --git a/docs/index.md b/docs/index.md
index 6abc4f04..83e30a69 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -50,7 +50,7 @@ Some reasons you might want to use REST framework:
REST framework requires the following:
* Python (2.6.5+, 2.7, 3.2, 3.3)
-* Django (1.3, 1.4, 1.5, 1.6)
+* Django (1.4.2+, 1.5, 1.6, 1.7)
The following packages are optional:
diff --git a/docs/topics/2.4-accouncement.md b/docs/topics/2.4-accouncement.md
index 91472b9c..cdc99bd5 100644
--- a/docs/topics/2.4-accouncement.md
+++ b/docs/topics/2.4-accouncement.md
@@ -1,4 +1,3 @@
-* Writable nested serializers.
* List/detail routes.
* 1.3 Support dropped, install six for <=1.4.?.
* `allow_none` for char fields
diff --git a/rest_framework/compat.py b/rest_framework/compat.py
index 4b16a8ca..fa0f0bfb 100644
--- a/rest_framework/compat.py
+++ b/rest_framework/compat.py
@@ -9,14 +9,9 @@ import django
import inspect
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
+from django.utils import six
-# Try to import six from Django, fallback to external `six` package.
-try:
- from django.utils import six
-except ImportError:
- import six
-
# Handle django.utils.encoding rename in 1.5 onwards.
# smart_unicode -> smart_text
# force_unicode -> force_text
diff --git a/rest_framework/decorators.py b/rest_framework/decorators.py
index e06d6ff5..449ba0a2 100644
--- a/rest_framework/decorators.py
+++ b/rest_framework/decorators.py
@@ -7,7 +7,7 @@ based views, as well as the `@detail_route` and `@list_route` decorators, which
used to annotate methods on viewsets that should be included by routers.
"""
from __future__ import unicode_literals
-from rest_framework.compat import six
+from django.utils import six
from rest_framework.views import APIView
import types
import warnings
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 85fcbd96..9d707c9b 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -18,14 +18,14 @@ from django.conf import settings
from django.db.models.fields import BLANK_CHOICE_DASH
from django.http import QueryDict
from django.forms import widgets
-from django.utils import timezone
+from django.utils import six, timezone
from django.utils.encoding import is_protected_type
from django.utils.translation import ugettext_lazy as _
from django.utils.datastructures import SortedDict
from django.utils.dateparse import parse_date, parse_datetime, parse_time
from rest_framework import ISO_8601
from rest_framework.compat import (
- BytesIO, six, smart_text,
+ BytesIO, smart_text,
force_text, is_non_str_iterable
)
from rest_framework.settings import api_settings
diff --git a/rest_framework/filters.py b/rest_framework/filters.py
index 28927eec..e2080013 100644
--- a/rest_framework/filters.py
+++ b/rest_framework/filters.py
@@ -5,7 +5,8 @@ returned by list views.
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.db import models
-from rest_framework.compat import django_filters, six, guardian, get_model_name
+from django.utils import six
+from rest_framework.compat import django_filters, guardian, get_model_name
from rest_framework.settings import api_settings
from functools import reduce
import operator
diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py
index 4990971b..aa4fd3f1 100644
--- a/rest_framework/parsers.py
+++ b/rest_framework/parsers.py
@@ -10,7 +10,8 @@ from django.core.files.uploadhandler import StopFutureHandlers
from django.http import QueryDict
from django.http.multipartparser import MultiPartParser as DjangoMultiPartParser
from django.http.multipartparser import MultiPartParserError, parse_header, ChunkIter
-from rest_framework.compat import etree, six, yaml, force_text
+from django.utils import six
+from rest_framework.compat import etree, yaml, force_text
from rest_framework.exceptions import ParseError
from rest_framework import renderers
import json
diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py
index ac7175a7..748ebac9 100644
--- a/rest_framework/renderers.py
+++ b/rest_framework/renderers.py
@@ -15,11 +15,9 @@ from django.core.exceptions import ImproperlyConfigured
from django.http.multipartparser import parse_header
from django.template import RequestContext, loader, Template
from django.test.client import encode_multipart
+from django.utils import six
from django.utils.xmlutils import SimplerXMLGenerator
-from rest_framework.compat import StringIO
-from rest_framework.compat import six
-from rest_framework.compat import smart_text
-from rest_framework.compat import yaml
+from rest_framework.compat import StringIO, smart_text, yaml
from rest_framework.exceptions import ParseError
from rest_framework.settings import api_settings
from rest_framework.request import is_form_media_type, override_method
diff --git a/rest_framework/response.py b/rest_framework/response.py
index 80225cac..0a7d313f 100644
--- a/rest_framework/response.py
+++ b/rest_framework/response.py
@@ -8,7 +8,7 @@ from __future__ import unicode_literals
import django
from django.core.handlers.wsgi import STATUS_CODE_TEXT
from django.template.response import SimpleTemplateResponse
-from rest_framework.compat import six
+from django.utils import six
class Response(SimpleTemplateResponse):
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 95288671..be8ad3f2 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -20,9 +20,9 @@ from django.contrib.contenttypes.generic import GenericForeignKey
from django.core.paginator import Page
from django.db import models
from django.forms import widgets
+from django.utils import six
from django.utils.datastructures import SortedDict
from django.core.exceptions import ObjectDoesNotExist
-from rest_framework.compat import six
from rest_framework.settings import api_settings
diff --git a/rest_framework/settings.py b/rest_framework/settings.py
index 6806a468..644751f8 100644
--- a/rest_framework/settings.py
+++ b/rest_framework/settings.py
@@ -18,12 +18,9 @@ REST framework settings, checking for user settings first, then falling
back to the defaults.
"""
from __future__ import unicode_literals
-
from django.conf import settings
-from django.utils import importlib
-
+from django.utils import importlib, six
from rest_framework import ISO_8601
-from rest_framework.compat import six
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None)
diff --git a/rest_framework/templatetags/rest_framework.py b/rest_framework/templatetags/rest_framework.py
index 9110aedb..b80a7d77 100644
--- a/rest_framework/templatetags/rest_framework.py
+++ b/rest_framework/templatetags/rest_framework.py
@@ -2,11 +2,12 @@ from __future__ import unicode_literals, absolute_import
from django import template
from django.core.urlresolvers import reverse, NoReverseMatch
from django.http import QueryDict
+from django.utils import six
from django.utils.encoding import iri_to_uri
from django.utils.html import escape
from django.utils.safestring import SafeData, mark_safe
-from rest_framework.compat import urlparse, force_text, six
from django.utils.html import smart_urlquote
+from rest_framework.compat import urlparse, force_text
import re
register = template.Library()
diff --git a/rest_framework/test.py b/rest_framework/test.py
index 9242cf7c..f89a6dcd 100644
--- a/rest_framework/test.py
+++ b/rest_framework/test.py
@@ -8,10 +8,11 @@ from django.conf import settings
from django.test.client import Client as DjangoClient
from django.test.client import ClientHandler
from django.test import testcases
+from django.utils import six
from django.utils.http import urlencode
from rest_framework.settings import api_settings
from rest_framework.compat import RequestFactory as DjangoRequestFactory
-from rest_framework.compat import force_bytes_or_smart_bytes, six
+from rest_framework.compat import force_bytes_or_smart_bytes
def force_authenticate(request, user=None, token=None):
diff --git a/tests/test_authentication.py b/tests/test_authentication.py
index 9db4f62d..2b9d73e4 100644
--- a/tests/test_authentication.py
+++ b/tests/test_authentication.py
@@ -3,7 +3,7 @@ from django.conf.urls import patterns, url, include
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.test import TestCase
-from django.utils import unittest
+from django.utils import six, unittest
from django.utils.http import urlencode
from rest_framework import HTTP_HEADER_ENCODING
from rest_framework import exceptions
@@ -20,7 +20,6 @@ from rest_framework.authentication import (
OAuth2Authentication
)
from rest_framework.authtoken.models import Token
-from rest_framework.compat import six
from rest_framework.compat import oauth2_provider, oauth2_provider_scope
from rest_framework.compat import oauth, oauth_provider
from rest_framework.test import APIRequestFactory, APIClient
diff --git a/tests/test_files.py b/tests/test_files.py
index af110df9..de4f71d1 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -1,8 +1,8 @@
from __future__ import unicode_literals
from django.test import TestCase
+from django.utils import six
from rest_framework import serializers
from rest_framework.compat import BytesIO
-from rest_framework.compat import six
import datetime
diff --git a/tests/test_generics.py b/tests/test_generics.py
index 36832aff..e9f5bebd 100644
--- a/tests/test_generics.py
+++ b/tests/test_generics.py
@@ -2,11 +2,11 @@ from __future__ import unicode_literals
from django.db import models
from django.shortcuts import get_object_or_404
from django.test import TestCase
+from django.utils import six
from rest_framework import generics, renderers, serializers, status
from rest_framework.test import APIRequestFactory
from tests.models import BasicModel, Comment, SlugBasedModel
from tests.models import ForeignKeySource, ForeignKeyTarget
-from rest_framework.compat import six
factory = APIRequestFactory()
diff --git a/tests/test_htmlrenderer.py b/tests/test_htmlrenderer.py
index 5a680f99..2edc6b4b 100644
--- a/tests/test_htmlrenderer.py
+++ b/tests/test_htmlrenderer.py
@@ -4,12 +4,12 @@ from django.conf.urls import patterns, url
from django.http import Http404
from django.test import TestCase
from django.template import TemplateDoesNotExist, Template
-import django.template.loader
+from django.utils import six
from rest_framework import status
from rest_framework.decorators import api_view, renderer_classes
from rest_framework.renderers import TemplateHTMLRenderer
from rest_framework.response import Response
-from rest_framework.compat import six
+import django.template.loader
@api_view(('GET',))
diff --git a/tests/test_relations_pk.py b/tests/test_relations_pk.py
index c051b076..e3f836ed 100644
--- a/tests/test_relations_pk.py
+++ b/tests/test_relations_pk.py
@@ -1,12 +1,12 @@
from __future__ import unicode_literals
from django.db import models
from django.test import TestCase
+from django.utils import six
from rest_framework import serializers
from tests.models import (
BlogPost, ManyToManyTarget, ManyToManySource, ForeignKeyTarget, ForeignKeySource,
NullableForeignKeySource, OneToOneTarget, NullableOneToOneSource,
)
-from rest_framework.compat import six
# ManyToMany
diff --git a/tests/test_renderers.py b/tests/test_renderers.py
index 0403cde2..91244e26 100644
--- a/tests/test_renderers.py
+++ b/tests/test_renderers.py
@@ -6,10 +6,10 @@ from django.conf.urls import patterns, url, include
from django.core.cache import cache
from django.db import models
from django.test import TestCase
-from django.utils import unittest
+from django.utils import six, unittest
from django.utils.translation import ugettext_lazy as _
from rest_framework import status, permissions
-from rest_framework.compat import yaml, etree, six, StringIO
+from rest_framework.compat import yaml, etree, StringIO
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.renderers import BaseRenderer, JSONRenderer, YAMLRenderer, \
diff --git a/tests/test_request.py b/tests/test_request.py
index 8b048b5c..8ddaf0a7 100644
--- a/tests/test_request.py
+++ b/tests/test_request.py
@@ -8,6 +8,7 @@ from django.contrib.auth import authenticate, login, logout
from django.contrib.sessions.middleware import SessionMiddleware
from django.core.handlers.wsgi import WSGIRequest
from django.test import TestCase
+from django.utils import six
from rest_framework import status
from rest_framework.authentication import SessionAuthentication
from rest_framework.parsers import (
@@ -21,7 +22,6 @@ from rest_framework.response import Response
from rest_framework.settings import api_settings
from rest_framework.test import APIRequestFactory, APIClient
from rest_framework.views import APIView
-from rest_framework.compat import six
from io import BytesIO
import json
diff --git a/tests/test_response.py b/tests/test_response.py
index c28f186e..2eff83d3 100644
--- a/tests/test_response.py
+++ b/tests/test_response.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
from django.conf.urls import patterns, url, include
from django.test import TestCase
+from django.utils import six
from tests.models import BasicModel, BasicModelSerializer
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -14,7 +15,6 @@ from rest_framework.renderers import (
)
from rest_framework import viewsets
from rest_framework.settings import api_settings
-from rest_framework.compat import six
class MockPickleRenderer(BaseRenderer):
diff --git a/tests/test_serializers.py b/tests/test_serializers.py
index 09de9f4c..31c41730 100644
--- a/tests/test_serializers.py
+++ b/tests/test_serializers.py
@@ -1,5 +1,5 @@
from django.test import TestCase
-from rest_framework.compat import six
+from django.utils import six
from rest_framework.serializers import _resolve_model
from tests.models import BasicModel
diff --git a/tests/utils.py b/tests/utils.py
index a8f2eb0b..28be81bd 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,5 +1,5 @@
from contextlib import contextmanager
-from rest_framework.compat import six
+from django.utils import six
from rest_framework.settings import api_settings