Support Django 2.2 and 3.0

This commit is contained in:
Yohann D'ANELLO 2020-04-25 02:59:37 +02:00 committed by Valentin Samir
parent 5f30d614e5
commit 4129687e41
15 changed files with 113 additions and 19 deletions

View file

@ -1,9 +1,9 @@
language: python language: python
matrix: matrix:
include: include:
- python: "3.7" - python: "3.8"
env: TOX_ENV=flake8 env: TOX_ENV=flake8
- python: "3.7" - python: "3.8"
env: TOX_ENV=check_rst env: TOX_ENV=check_rst
- python: "2.7" - python: "2.7"
env: TOX_ENV=py27-django111 env: TOX_ENV=py27-django111
@ -20,6 +20,10 @@ matrix:
- python: "3.6" - python: "3.6"
env: TOX_ENV=py36-django21 env: TOX_ENV=py36-django21
- python: "3.7" - python: "3.7"
env: TOX_ENV=py37-django22
- python: "3.8"
env: TOX_ENV=py38-django30
- python: "3.8"
env: TOX_ENV=coverage env: TOX_ENV=coverage
cache: cache:
directories: directories:

View file

@ -29,7 +29,7 @@ Dependencies
``django-cas-server`` depends on the following python packages: ``django-cas-server`` depends on the following python packages:
* Django >= 1.11 < 2.1 * Django >= 1.11 <= 3.0
* requests >= 2.4 * requests >= 2.4
* requests_futures >= 0.9.5 * requests_futures >= 0.9.5
* lxml >= 3.4 * lxml >= 3.4

View file

@ -9,9 +9,14 @@
# #
# (c) 2015-2016 Valentin Samir # (c) 2015-2016 Valentin Samir
"""django config module""" """django config module"""
from django.utils.translation import ugettext_lazy as _
from django.apps import AppConfig from django.apps import AppConfig
import sys
if sys.version_info < (3, ):
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _
class CasAppConfig(AppConfig): class CasAppConfig(AppConfig):
""" """

View file

@ -12,10 +12,15 @@
"""Default values for the app's settings""" """Default values for the app's settings"""
from django.conf import settings from django.conf import settings
from django.templatetags.static import static from django.templatetags.static import static
from django.utils.translation import ugettext_lazy as _
from importlib import import_module from importlib import import_module
import sys
if sys.version_info < (3, ):
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _
try: try:
#: URL to the logo showed in the up left corner on the default templates. #: URL to the logo showed in the up left corner on the default templates.

View file

@ -13,11 +13,16 @@ from .default_settings import settings
from django import forms from django import forms
from django.forms import widgets from django.forms import widgets
from django.utils.translation import ugettext_lazy as _
import cas_server.utils as utils import cas_server.utils as utils
import cas_server.models as models import cas_server.models as models
import sys
if sys.version_info < (3, ):
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _
class BootsrapForm(forms.Form): class BootsrapForm(forms.Form):
""" """

View file

@ -10,10 +10,15 @@
# #
# (c) 2016 Valentin Samir # (c) 2016 Valentin Samir
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
from ... import models from ... import models
import sys
if sys.version_info < (3, ):
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _
class Command(BaseCommand): class Command(BaseCommand):
args = '' args = ''

View file

@ -11,10 +11,15 @@
# (c) 2016 Valentin Samir # (c) 2016 Valentin Samir
"""Clean deleted sessions management command""" """Clean deleted sessions management command"""
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
from ... import models from ... import models
import sys
if sys.version_info < (3,):
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _
class Command(BaseCommand): class Command(BaseCommand):
"""Clean deleted sessions""" """Clean deleted sessions"""

View file

@ -11,10 +11,15 @@
# (c) 2016 Valentin Samir # (c) 2016 Valentin Samir
"""Clean old trickets management command""" """Clean old trickets management command"""
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_lazy as _
from ... import models from ... import models
import sys
if sys.version_info < (3, ):
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _
class Command(BaseCommand): class Command(BaseCommand):
"""Clean old trickets""" """Clean old trickets"""

View file

@ -15,9 +15,13 @@ from .default_settings import settings, SessionStore
from django.db import models from django.db import models
from django.db.models import Q from django.db.models import Q
from django.contrib import messages from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible try:
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
except ImportError:
def python_2_unicode_compatible(f): return f
from django.utils.translation import gettext_lazy as _
from django.core.mail import send_mail from django.core.mail import send_mail
import re import re

View file

@ -18,11 +18,12 @@ from django.contrib.messages import constants as DEFAULT_MESSAGE_LEVELS
from django.core.serializers.json import DjangoJSONEncoder from django.core.serializers.json import DjangoJSONEncoder
from django.utils import timezone from django.utils import timezone
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
try: try:
from django.urls import reverse from django.urls import reverse
from django.utils.translation import gettext_lazy as _
except ImportError: except ImportError:
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
import re import re
import random import random

View file

@ -16,12 +16,16 @@ from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import messages from django.contrib import messages
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.utils import timezone from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.middleware.csrf import CsrfViewMiddleware from django.middleware.csrf import CsrfViewMiddleware
from django.views.generic import View from django.views.generic import View
from django.utils.encoding import python_2_unicode_compatible try:
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
except ImportError:
def python_2_unicode_compatible(f): return f
from django.utils.translation import gettext as _
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
try: try:
from django.urls import reverse from django.urls import reverse
@ -256,7 +260,7 @@ class FederateAuth(CsrfExemptView):
self.service_url = service_url self.service_url = service_url
return CASFederateValidateUser(provider, service_url, renew=renew) return CASFederateValidateUser(provider, service_url, renew=renew)
def post(self, request, provider=None): def post(self, request, provider=None, *args, **kwargs):
""" """
method called on POST request method called on POST request
@ -1395,7 +1399,7 @@ class SamlValidate(CsrfExemptView):
ticket = None ticket = None
root = None root = None
def post(self, request): def post(self, request, *args, **kwargs):
""" """
method called on POST request on this view method called on POST request on this view

View file

@ -7,6 +7,5 @@ tox>=1.8.1
pytest>=2.6.4 pytest>=2.6.4
pytest-django>=2.8.0 pytest-django>=2.8.0
pytest-pythonpath>=0.3 pytest-pythonpath>=0.3
pytest-warnings
pytest-cov>=2.2.1 pytest-cov>=2.2.1
mock>=1 mock>=1

View file

@ -1,4 +1,4 @@
Django >= 1.11,<2.2 Django >= 1.11,<=3.0
setuptools>=5.5 setuptools>=5.5
requests>=2.4 requests>=2.4
requests_futures>=0.9.5 requests_futures>=0.9.5

View file

@ -34,6 +34,8 @@ if __name__ == '__main__':
'Framework :: Django :: 1.11', 'Framework :: Django :: 1.11',
'Framework :: Django :: 2.0', 'Framework :: Django :: 2.0',
'Framework :: Django :: 2.1', 'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Intended Audience :: Developers', 'Intended Audience :: Developers',
'Intended Audience :: System Administrators', 'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
@ -44,6 +46,8 @@ if __name__ == '__main__':
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
@ -58,7 +62,7 @@ if __name__ == '__main__':
}, },
keywords=['django', 'cas', 'cas3', 'server', 'sso', 'single sign-on', 'authentication', 'auth'], keywords=['django', 'cas', 'cas3', 'server', 'sso', 'single sign-on', 'authentication', 'auth'],
install_requires=[ install_requires=[
'Django >= 1.11,<2.2', 'requests >= 2.4', 'requests_futures >= 0.9.5', 'Django >= 1.11,<=3.0', 'requests >= 2.4', 'requests_futures >= 0.9.5',
'lxml >= 3.4', 'six >= 1' 'lxml >= 3.4', 'six >= 1'
], ],
url="https://github.com/nitmir/django-cas-server", url="https://github.com/nitmir/django-cas-server",

48
tox.ini
View file

@ -9,6 +9,13 @@ envlist=
py36-django20, py36-django20,
py35-django21, py35-django21,
py36-django21, py36-django21,
py37-django21,
py36-django22,
py37-django22,
py38-django22,
py36-django30,
py37-django30,
py38-django30,
[flake8] [flake8]
max-line-length=100 max-line-length=100
@ -118,6 +125,47 @@ deps =
Django>=2.1,<2.2 Django>=2.1,<2.2
{[base]deps} {[base]deps}
[testenv:py37-django21]
basepython=python3.7
deps =
Django>=2.1,<2.2
{[base]deps}
[testenv:py36-django22]
basepython=python3.6
deps =
Django>=2.2,<3.0
{[base]deps}
[testenv:py37-django22]
basepython=python3.7
deps =
Django>=2.2,<3.0
{[base]deps}
[testenv:py38-django22]
basepython=python3.8
deps =
Django>=2.2,<3.0
{[base]deps}
[testenv:py36-django30]
basepython=python3.6
deps =
Django>=3.0,<3.1
{[base]deps}
[testenv:py37-django30]
basepython=python3.7
deps =
Django>=3.0,<3.1
{[base]deps}
[testenv:py38-django30]
basepython=python3.8
deps =
Django>=3.0,<3.1
{[base]deps}
[testenv:flake8] [testenv:flake8]