From 84a00ca255a658c8f339cddadade450d5282aee9 Mon Sep 17 00:00:00 2001 From: FanHan Date: Mon, 19 Sep 2016 12:17:27 +0800 Subject: [PATCH] Django 1.10 support --- .travis.yml | 2 ++ corsheaders/middleware.py | 9 +++++++-- tox.ini | 21 ++++++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 309acbd5..3ee42f2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - 3.2 - 3.3 - 3.4 + - 3.5 env: - DJANGO_VERSION="Django==1.3.7" @@ -13,6 +14,7 @@ env: - DJANGO_VERSION="Django==1.6.7" - DJANGO_VERSION="Django==1.7.0" - DJANGO_VERSION="Django==1.8.0" + - DJANGO_VERSION="Django==1.10.1" matrix: exclude: diff --git a/corsheaders/middleware.py b/corsheaders/middleware.py index f22ee587..c6c1af83 100755 --- a/corsheaders/middleware.py +++ b/corsheaders/middleware.py @@ -12,6 +12,11 @@ except ImportError: from django.db.models.loading import get_model +try: + from django.utils.deprecation import MiddlewareMixin +except ImportError: + MiddlewareMixin = object + from corsheaders import defaults as settings @@ -23,7 +28,7 @@ ACCESS_CONTROL_MAX_AGE = 'Access-Control-Max-Age' -class CorsPostCsrfMiddleware(object): +class CorsPostCsrfMiddleware(MiddlewareMixin): def _https_referer_replace_reverse(self, request): """ @@ -45,7 +50,7 @@ def process_view(self, request, callback, callback_args, callback_kwargs): return None -class CorsMiddleware(object): +class CorsMiddleware(MiddlewareMixin): def _https_referer_replace(self, request): """ diff --git a/tox.ini b/tox.ini index f30e9afd..1bf8ae93 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,7 @@ envlist = py27-django16, py27-django17, py27-django18, + py27-django110, py32-django15, py32-django16, py32-django17, @@ -23,6 +24,8 @@ envlist = py34-django16, py34-django17, py34-django18, + py34-django110, + py35-django110, [testenv] commands = python setup.py test @@ -45,6 +48,9 @@ deps = django == 1.7.0 [django18] deps = django == 1.8.0 +[django110] +deps = django == 1.10.1 + [testenv:py26-django13] basepython = python2.6 deps = {[django13]deps} @@ -86,6 +92,10 @@ deps = {[django17]deps} basepython = python2.7 deps = {[django18]deps} +[testenv:py27-django110] +basepython = python2.7 +deps = {[django110]deps} + [testenv:py32-django15] basepython = python3.2 @@ -134,5 +144,14 @@ basepython = python3.4 deps = {[django17]deps} [testenv:py34-django18] -basepython = python3.3 +basepython = python3.4 deps = {[django14]deps} + +[testenv:py34-django110] +basepython = python3.4 +deps = {[django110]deps} + + +[testenv:py35-django110] +basepython = python3.5 +deps = {[django110]deps} \ No newline at end of file