Skip to content

Update for modern Django 4.0+ #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dist: xenial
dist: focal
sudo: false
language: python
python:
- "3.6"
- "3.8"
install: pip install tox-travis
script: tox
47 changes: 47 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
pipeline {
agent {
label "python"
}
stages {
stage('Virtualenv'){
steps {
sh '/usr/bin/virtualenv toxtest -p /usr/bin/python3'
sh 'toxtest/bin/pip install tox==3.28.0 pathlib2'
}
}
stage('Test'){
parallel {
stage('Unit Test Django 3.0'){
steps {
sh 'toxtest/bin/tox -e py3.8-django{3.0}'
}
}
stage('Unit Test Django 3.1'){
steps {
sh 'toxtest/bin/tox -e py3.8-django{3.1}'
}
}
stage('Unit Test Django 3.2'){
steps {
sh 'toxtest/bin/tox -e py3.8-django{3.2}'
}
}
stage('Unit Test Django 4.0'){
steps {
sh 'toxtest/bin/tox -e py3.8-django{4.0}'
}
}
stage('Unit Test Django 4.1'){
steps {
sh 'toxtest/bin/tox -e py3.8-django{4.1}'
}
}
}
}
}
post {
cleanup {
cleanWs()
}
}
}
6 changes: 3 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Vagrant.configure(2) do |config|

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/bionic64"
config.vm.box = "ubuntu/focal64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
Expand Down Expand Up @@ -67,9 +67,9 @@ Vagrant.configure(2) do |config|
config.vm.provision "shell", privileged: false, inline: <<-SHELL
sudo resize2fs /dev/sda1
sudo apt-get update
sudo apt-get install -y build-essential python-dev python-pip python-virtualenv python3-dev python3 python3-virtualenv virtualenv virtualenvwrapper postgresql libpq-dev memcached redis-server redis-tools
sudo apt-get install -y build-essential python3-dev python3-pip python3-dev python3 python3-virtualenv virtualenv virtualenvwrapper postgresql libpq-dev memcached redis-server redis-tools

sudo -H pip install tox
sudo -H pip3 install tox==3.28.0 virtualenv

echo "export TOX_WORK_DIR=/tmp/" >> ~/.bash_aliases

Expand Down
3 changes: 2 additions & 1 deletion provider/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__version__ = "3.2"
__version__ = "4.0"
# The major version is expected to follow the current django major version:q
2 changes: 1 addition & 1 deletion provider/oauth2/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from django import forms
from django.contrib.auth import authenticate
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.utils import timezone
from provider.constants import RESPONSE_TYPE_CHOICES, SCOPES, PUBLIC
from provider.forms import OAuthForm, OAuthValidationError
Expand Down
6 changes: 3 additions & 3 deletions provider/oauth2/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import path
from django.http.response import JsonResponse
from django.views.generic import View
from django.contrib.auth.mixins import LoginRequiredMixin
Expand Down Expand Up @@ -37,6 +37,6 @@ def get(self, request, *args, **kwargs):


urlpatterns = [
url('^badscope$', BadScopeView.as_view(), name='badscope'),
url('^user/(?P<pk>\d+)$', UserView.as_view(), name='user'),
path('badscope', BadScopeView.as_view(), name='badscope'),
path('user/<int:pk>', UserView.as_view(), name='user'),
]
10 changes: 5 additions & 5 deletions provider/oauth2/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@

from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.conf.urls import url, include
from django.urls import path
from provider.oauth2 import views

app_name = 'oauth2'

urlpatterns = [
url('^authorize/?$',
path('authorize',
login_required(views.CaptureView.as_view()),
name='capture'),
url('^authorize/confirm/?$',
path('authorize/confirm',
login_required(views.AuthorizeView.as_view()),
name='authorize'),
url('^redirect/?$',
path('redirect',
login_required(views.RedirectView.as_view()),
name='redirect'),
url('^access_token/?$',
path('access_token',
csrf_exempt(views.AccessTokenView.as_view()),
name='access_token'),
]
2 changes: 1 addition & 1 deletion provider/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from django.http import HttpResponse
from django.http import HttpResponseRedirect, QueryDict
from django.utils.translation import ugettext as _
from django.utils.translation import gettext as _
from django.views.generic.base import TemplateView, View
from django.core.exceptions import ObjectDoesNotExist
from provider.oauth2.models import Client, Scope
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django>=2.1
shortuuid>=0.4
six>=0.11.0
sqlparse>=0.2.4
Django==3.2
shortuuid==1.0.11
six>=0.16.0
sqlparse>=0.4.3
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
'Framework :: Django',
],
install_requires=[
"shortuuid>=0.4",
"six>=0.11.0",
"sqlparse>=0.2.4",
"shortuuid>=1.0.11",
"six>=0.16.0",
"sqlparse>=0.4.3",
],
include_package_data=True,
zip_safe=False,
Expand Down
8 changes: 4 additions & 4 deletions tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.conf.urls import url, include
from django.urls import path, include
from django.contrib import admin

admin.autodiscover()

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^oauth2/', include('provider.oauth2.urls', namespace='oauth2')),
url(r'^tests/', include('provider.oauth2.tests.urls', namespace='tests')),
path('admin/', admin.site.urls),
path('oauth2/', include('provider.oauth2.urls', namespace='oauth2')),
path('tests/', include('provider.oauth2.tests.urls', namespace='tests')),
]
35 changes: 18 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
toxworkdir={env:TOX_WORK_DIR:.tox}
downloadcache = {toxworkdir}/cache/
envlist = py{3.6}-django{2.1,2.2,3.0,3.1}
envlist = py{3.8,3.9,3.10}-django{3.0,3.1,3.2,4.0,4.1}

[testenv]
setenv =
Expand All @@ -12,29 +12,30 @@ deps =

[travis]
python =
3.6: py3.6-django{2.1,2.2,3.0,3.1}
3.8: py3.8-django{3.0,3.1,3.2,4.0,4.1}

[testenv:py3.6-django2.0]
basepython = python3.6
deps = Django>=2.0,<2.1

[testenv:py3.8-django3.0]
basepython = python3.8
deps = Django>=3.0,<3.1
{[testenv]deps}

[testenv:py3.6-django2.1]
basepython = python3.6
deps = Django>=2.1,<2.2
[testenv:py3.8-django3.1]
basepython = python3.8
deps = Django>=3.1,<3.2
{[testenv]deps}

[testenv:py3.6-django2.2]
basepython = python3.6
deps = Django>=2.2,<2.2.10
[testenv:py3.8-django3.2]
basepython = python3.8
deps = Django>=3.2,<4.0
{[testenv]deps}

[testenv:py3.6-django3.0]
basepython = python3.6
deps = Django>=3.0,<3.1
[testenv:py3.8-django4.0]
basepython = python3.8
deps = Django>=4.0,<4.1
{[testenv]deps}

[testenv:py3.6-django3.1]
basepython = python3.6
deps = Django>=3.1
[testenv:py3.8-django4.1]
basepython = python3.8
deps = Django>=4.1,<4.2
{[testenv]deps}