Projet

Général

Profil

0002-misc-apply-django-upgrade-69426.patch

Valentin Deniaud, 22 septembre 2022 11:40

Télécharger (49,3 ko)

Voir les différences:

Subject: [PATCH 2/3] misc: apply django-upgrade (#69426)

 src/authentic2/api_urls.py                    |  30 +--
 src/authentic2/api_views.py                   |   5 +-
 src/authentic2/cbv.py                         |   2 +-
 src/authentic2/decorators.py                  |   4 +-
 .../disco_service/disco_responder.py          |   7 +-
 src/authentic2/forms/widgets.py               |   9 +-
 src/authentic2/idp/saml/urls.py               |  28 +--
 src/authentic2/idp/urls.py                    |   4 +-
 src/authentic2/manager/urls.py                | 184 +++++++++---------
 src/authentic2/middleware.py                  |   2 +-
 src/authentic2/saml/admin.py                  |   6 +-
 src/authentic2/saml/common.py                 |   2 +-
 src/authentic2/urls.py                        | 104 +++++-----
 src/authentic2/utils/misc.py                  |   2 +-
 src/authentic2/views.py                       |   2 +-
 src/authentic2_auth_fc/urls.py                |  10 +-
 src/authentic2_auth_oidc/urls.py              |   7 +-
 src/authentic2_auth_saml/urls.py              |   5 +-
 src/authentic2_idp_cas/urls.py                |  16 +-
 src/authentic2_idp_oidc/manager/urls.py       |  16 +-
 src/authentic2_idp_oidc/urls.py               |  16 +-
 src/authentic2_idp_oidc/views.py              |   4 +-
 tests/cache_urls.py                           |   4 +-
 tests/conftest.py                             |   4 -
 tests/test_journal_app/urls.py                |   4 +-
 25 files changed, 233 insertions(+), 244 deletions(-)
src/authentic2/api_urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path, re_path
18 18

  
19 19
from . import api_views
20 20

  
21 21
urlpatterns = [
22
    url(r'^register/$', api_views.register, name='a2-api-register'),
23
    url(r'^password-change/$', api_views.password_change, name='a2-api-password-change'),
24
    url(r'^user/$', api_views.user, name='a2-api-user'),
25
    url(
22
    path('register/', api_views.register, name='a2-api-register'),
23
    path('password-change/', api_views.password_change, name='a2-api-password-change'),
24
    path('user/', api_views.user, name='a2-api-user'),
25
    re_path(
26 26
        r'^users/(?P<user_uuid>[\w+]*)/profiles/(?P<profile_type_slug>[^/]+)/$',
27 27
        api_views.user_profiles,
28 28
        name='a2-api-user-profiles',
29 29
    ),
30
    url(
30
    re_path(
31 31
        r'^roles/(?P<role_uuid>[\w+]*)/members/$',
32 32
        api_views.roles_members,
33 33
        name='a2-api-role-members-list',
34 34
    ),
35
    url(
35
    re_path(
36 36
        r'^roles/(?P<role_uuid>[\w+]*)/members/(?P<member_uuid>[^/]+)/$',
37 37
        api_views.role_membership,
38 38
        name='a2-api-role-member',
39 39
    ),
40
    url(
40
    re_path(
41 41
        r'^roles/(?P<role_uuid>[\w+]*)/relationships/members/$',
42 42
        api_views.role_memberships,
43 43
        name='a2-api-role-members',
44 44
    ),
45
    url(
45
    re_path(
46 46
        r'^roles/(?P<role_uuid>[0-9a-z]{32})/parents/$',
47 47
        api_views.roles_parents,
48 48
        name='a2-api-role-parents',
49 49
    ),
50
    url(
50
    re_path(
51 51
        r'^roles/(?P<role_uuid>[0-9a-z]{32})/relationships/parents/$',
52 52
        api_views.roles_parents_relationships,
53 53
        name='a2-api-role-parents-relationships',
54 54
    ),
55
    url(r'^check-password/$', api_views.check_password, name='a2-api-check-password'),
56
    url(r'^check-api-client/$', api_views.check_api_client, name='a2-api-check-api-client'),
57
    url(r'^validate-password/$', api_views.validate_password, name='a2-api-validate-password'),
58
    url(r'^password-strength/$', api_views.password_strength, name='a2-api-password-strength'),
59
    url(r'^address-autocomplete/$', api_views.address_autocomplete, name='a2-api-address-autocomplete'),
55
    path('check-password/', api_views.check_password, name='a2-api-check-password'),
56
    path('check-api-client/', api_views.check_api_client, name='a2-api-check-api-client'),
57
    path('validate-password/', api_views.validate_password, name='a2-api-validate-password'),
58
    path('password-strength/', api_views.password_strength, name='a2-api-password-strength'),
59
    path('address-autocomplete/', api_views.address_autocomplete, name='a2-api-address-autocomplete'),
60 60
]
61 61

  
62 62
urlpatterns += api_views.router.urls
src/authentic2/api_views.py
39 39
from django_filters.utils import handle_timezone
40 40
from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
41 41
from requests.exceptions import RequestException
42
from rest_framework import authentication, pagination, permissions, serializers, status
42
from rest_framework import pagination, permissions, serializers, status
43 43
from rest_framework.authentication import SessionAuthentication
44 44
from rest_framework.exceptions import AuthenticationFailed, ErrorDetail, PermissionDenied, ValidationError
45 45
from rest_framework.fields import CreateOnlyDefault
......
73 73
    from . import validators
74 74

  
75 75
    rest_framework.fields.ProhibitNullCharactersValidator = validators.ProhibitNullCharactersValidator
76
if django.VERSION < (1, 11):
77
    authentication.authenticate = utils_misc.authenticate
78

  
79 76
User = get_user_model()
80 77

  
81 78

  
src/authentic2/cbv.py
69 69
        if REDIRECT_FIELD_NAME in request.GET:
70 70
            pass
71 71
        else:
72
            next_url = request.META.get('HTTP_REFERER') or self.next_url_default
72
            next_url = request.headers.get('Referer') or self.next_url_default
73 73
            return utils_misc.redirect(
74 74
                request,
75 75
                request.path,
src/authentic2/decorators.py
145 145
                    break
146 146
        # 1. check origin
147 147
        if jsonp:
148
            origin = request.META.get('HTTP_REFERER')
148
            origin = request.headers.get('Referer')
149 149
            if not origin:
150 150
                # JSONP is unusable for people without referers
151 151
                return HttpResponseForbidden('missing referrer', content_type='text/plain')
152 152
            origin = cors.make_origin(origin)
153 153
        else:
154
            origin = request.META.get('HTTP_ORIGIN')
154
            origin = request.headers.get('Origin')
155 155
        if origin:
156 156
            if not cors.check_origin(request, origin):
157 157
                return HttpResponseForbidden('bad origin', content_type='text/plain')
src/authentic2/disco_service/disco_responder.py
26 26
import urllib.parse
27 27
from xml.dom.minidom import parseString
28 28

  
29
from django.conf.urls import url
30 29
from django.http import HttpResponseRedirect
31
from django.urls import reverse
30
from django.urls import path, reverse
32 31
from django.utils.http import urlquote
33 32
from django.utils.translation import ugettext as _
34 33

  
......
226 225

  
227 226

  
228 227
urlpatterns = [
229
    url(r'^disco$', disco),
230
    url(r'^idp_selection$', idp_selection),
228
    path('disco', disco),
229
    path('idp_selection', idp_selection),
231 230
]
src/authentic2/forms/widgets.py
28 28
import re
29 29
import uuid
30 30

  
31
import django
32 31
from django import forms
33 32
from django.contrib.auth import get_user_model
34 33
from django.forms.widgets import ClearableFileInput, DateInput, DateTimeInput
......
321 320

  
322 321

  
323 322
class ProfileImageInput(ClearableFileInput):
324
    if django.VERSION < (1, 9):
325
        template_with_initial = (
326
            '%(initial_text)s: <a href="%(initial_url)s"><img src="%(initial_url)s"/></a>'
327
            ' %(clear_template)s<br />%(input_text)s: %(input)s'
328
        )
329
    else:
330
        template_name = "authentic2/profile_image_input.html"
323
    template_name = "authentic2/profile_image_input.html"
331 324

  
332 325
    def __init__(self, *args, **kwargs):
333 326
        attrs = kwargs.pop('attrs', {})
src/authentic2/idp/saml/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path, re_path
18 18

  
19 19
from authentic2.idp.saml.saml2_endpoints import (
20 20
    artifact,
......
32 32
from . import views
33 33

  
34 34
urlpatterns = [
35
    url(r'^metadata$', metadata, name='a2-idp-saml-metadata'),
36
    url(r'^sso$', sso, name='a2-idp-saml-sso'),
37
    url(r'^continue$', continue_sso, name='a2-idp-saml-continue'),
38
    url(r'^slo$', slo, name='a2-idp-saml-slo'),
39
    url(r'^slo/soap$', slo_soap, name='a2-idp-saml-slo-soap'),
40
    url(r'^idp_slo/(.*)$', idp_slo, name='a2-idp-saml-slo-idp'),
41
    url(r'^slo_return$', slo_return, name='a2-idp-saml-slo-return'),
42
    url(r'^finish_slo$', finish_slo, name='a2-idp-saml-finish-slo'),
43
    url(r'^artifact$', artifact, name='a2-idp-saml-artifact'),
35
    path('metadata', metadata, name='a2-idp-saml-metadata'),
36
    path('sso', sso, name='a2-idp-saml-sso'),
37
    path('continue', continue_sso, name='a2-idp-saml-continue'),
38
    path('slo', slo, name='a2-idp-saml-slo'),
39
    path('slo/soap', slo_soap, name='a2-idp-saml-slo-soap'),
40
    re_path(r'^idp_slo/(.*)$', idp_slo, name='a2-idp-saml-slo-idp'),
41
    path('slo_return', slo_return, name='a2-idp-saml-slo-return'),
42
    path('finish_slo', finish_slo, name='a2-idp-saml-finish-slo'),
43
    path('artifact', artifact, name='a2-idp-saml-artifact'),
44 44
    # legacy endpoint, now it's prefered to pass the entity_id in a parameter
45
    url(r'^idp_sso/(.+)$', idp_sso, name='a2-idp-saml-idp-sso-named'),
46
    url(r'^idp_sso/$', idp_sso, name='a2-idp-saml2-idp-sso'),
47
    url(r'^federations/create/(?P<pk>\d+)/$', views.create_federation, name='a2-idp-saml2-federation-create'),
48
    url(r'^federations/(?P<pk>\d+)/delete/$', views.delete_federation, name='a2-idp-saml2-federation-delete'),
45
    re_path(r'^idp_sso/(.+)$', idp_sso, name='a2-idp-saml-idp-sso-named'),
46
    path('idp_sso/', idp_sso, name='a2-idp-saml2-idp-sso'),
47
    path('federations/create/<int:pk>/', views.create_federation, name='a2-idp-saml2-federation-create'),
48
    path('federations/<int:pk>/delete/', views.delete_federation, name='a2-idp-saml2-federation-delete'),
49 49
]
src/authentic2/idp/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import re_path
18 18

  
19 19
from authentic2.idp.interactions import consent_federation
20 20

  
21 21
urlpatterns = [
22
    url(r'^consent_federation', consent_federation, name='a2-consent-federation'),
22
    re_path(r'^consent_federation', consent_federation, name='a2-consent-federation'),
23 23
]
src/authentic2/manager/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path, re_path
18 18
from django.views.i18n import JavaScriptCatalog
19 19

  
20 20
from authentic2.apps.authenticators.manager_urls import urlpatterns as authenticator_urlpatterns
......
27 27
    utils.manager_login_required,
28 28
    [
29 29
        # homepage
30
        url(r'^$', views.homepage, name='a2-manager-homepage'),
31
        url(r'^me/$', user_views.me, name='a2-manager-me'),
30
        path('', views.homepage, name='a2-manager-homepage'),
31
        path('me/', user_views.me, name='a2-manager-me'),
32 32
        # Authentic2 users
33
        url(r'^users/$', user_views.users, name='a2-manager-users'),
34
        url(r'^users/export/(?P<format>csv)/$', user_views.users_export, name='a2-manager-users-export'),
35
        url(
33
        path('users/', user_views.users, name='a2-manager-users'),
34
        re_path(r'^users/export/(?P<format>csv)/$', user_views.users_export, name='a2-manager-users-export'),
35
        re_path(
36 36
            r'^users/export/(?P<uuid>[a-z0-9-]+)/progress/$',
37 37
            user_views.users_export_progress,
38 38
            name='a2-manager-users-export-progress',
39 39
        ),
40
        url(
40
        re_path(
41 41
            r'^users/export/(?P<uuid>[a-z0-9-]+)/$',
42 42
            user_views.users_export_file,
43 43
            name='a2-manager-users-export-file',
44 44
        ),
45
        url(r'^users/add/$', user_views.user_add_default_ou, name='a2-manager-user-add-default-ou'),
46
        url(r'^users/add/choose-ou/$', user_views.user_add_choose_ou, name='a2-manager-user-add-choose-ou'),
47
        url(r'^users/import/$', user_views.user_imports, name='a2-manager-users-imports'),
48
        url(
45
        path('users/add/', user_views.user_add_default_ou, name='a2-manager-user-add-default-ou'),
46
        path('users/add/choose-ou/', user_views.user_add_choose_ou, name='a2-manager-user-add-choose-ou'),
47
        path('users/import/', user_views.user_imports, name='a2-manager-users-imports'),
48
        re_path(
49 49
            r'^users/import/(?P<uuid>[a-z0-9]+)/download/(?P<filename>.*)$',
50 50
            user_views.user_import,
51 51
            name='a2-manager-users-import-download',
52 52
        ),
53
        url(r'^users/import/(?P<uuid>[a-z0-9]+)/$', user_views.user_import, name='a2-manager-users-import'),
54
        url(
53
        re_path(
54
            r'^users/import/(?P<uuid>[a-z0-9]+)/$', user_views.user_import, name='a2-manager-users-import'
55
        ),
56
        re_path(
55 57
            r'^users/import/(?P<import_uuid>[a-z0-9]+)/(?P<report_uuid>[a-z0-9]+)/$',
56 58
            user_views.user_import_report,
57 59
            name='a2-manager-users-import-report',
58 60
        ),
59
        url(r'^users/(?P<ou_pk>\d+)/add/$', user_views.user_add, name='a2-manager-user-add'),
60
        url(r'^users/(?P<pk>\d+)/$', user_views.user_detail, name='a2-manager-user-detail'),
61
        url(r'^users/(?P<pk>\d+)/edit/$', user_views.user_edit, name='a2-manager-user-edit'),
62
        url(r'^users/(?P<pk>\d+)/delete/$', user_views.user_delete, name='a2-manager-user-delete'),
63
        url(r'^users/(?P<pk>\d+)/roles/$', user_views.roles, name='a2-manager-user-roles'),
64
        url(
65
            r'^users/(?P<pk>\d+)/change-password/$',
61
        path('users/<int:ou_pk>/add/', user_views.user_add, name='a2-manager-user-add'),
62
        path('users/<int:pk>/', user_views.user_detail, name='a2-manager-user-detail'),
63
        path('users/<int:pk>/edit/', user_views.user_edit, name='a2-manager-user-edit'),
64
        path('users/<int:pk>/delete/', user_views.user_delete, name='a2-manager-user-delete'),
65
        path('users/<int:pk>/roles/', user_views.roles, name='a2-manager-user-roles'),
66
        path(
67
            'users/<int:pk>/change-password/',
66 68
            user_views.user_change_password,
67 69
            name='a2-manager-user-change-password',
68 70
        ),
69
        url(
70
            r'^users/(?P<pk>\d+)/change-email/$',
71
        path(
72
            'users/<int:pk>/change-email/',
71 73
            user_views.user_change_email,
72 74
            name='a2-manager-user-change-email',
73 75
        ),
74
        url(r'^users/(?P<pk>\d+)/su/$', user_views.su, name='a2-manager-user-su'),
75
        url(
76
            r'^users/(?P<pk>\d+)/authorizations/$',
76
        path('users/<int:pk>/su/', user_views.su, name='a2-manager-user-su'),
77
        path(
78
            'users/<int:pk>/authorizations/',
77 79
            user_views.user_authorizations,
78 80
            name='a2-manager-user-authorizations',
79 81
        ),
80
        url(r'^users/(?P<pk>\d+)/journal/$', user_views.user_journal, name='a2-manager-user-journal'),
82
        path('users/<int:pk>/journal/', user_views.user_journal, name='a2-manager-user-journal'),
81 83
        # by uuid
82
        url(
84
        re_path(
83 85
            r'^users/uuid:(?P<slug>[a-z0-9]+)/$',
84 86
            user_views.user_detail,
85 87
            name='a2-manager-user-by-uuid-detail',
86 88
        ),
87
        url(
89
        re_path(
88 90
            r'^users/uuid:(?P<slug>[a-z0-9]+)/edit/$',
89 91
            user_views.user_edit,
90 92
            name='a2-manager-user-by-uuid-edit',
91 93
        ),
92
        url(
94
        re_path(
93 95
            r'^users/uuid:(?P<slug>[a-z0-9]+)/roles/$', user_views.roles, name='a2-manager-user-by-uuid-roles'
94 96
        ),
95
        url(
97
        re_path(
96 98
            r'^users/uuid:(?P<slug>[a-z0-9]+)/change-password/$',
97 99
            user_views.user_change_password,
98 100
            name='a2-manager-user-by-uuid-change-password',
99 101
        ),
100
        url(
102
        re_path(
101 103
            r'^users/uuid:(?P<slug>[a-z0-9]+)/change-email/$',
102 104
            user_views.user_change_email,
103 105
            name='a2-manager-user-by-uuid-change-email',
104 106
        ),
105
        url(
107
        re_path(
106 108
            r'^users/uuid:(?P<slug>[a-z0-9]+)/journal/$',
107 109
            user_views.user_journal,
108 110
            name='a2-manager-user-journal',
109 111
        ),
110 112
        # Authentic2 roles
111
        url(r'^roles/$', role_views.listing, name='a2-manager-roles'),
112
        url(r'^roles/import/$', role_views.roles_import, name='a2-manager-roles-import'),
113
        url(r'^roles/csv-import/$', role_views.roles_csv_import, name='a2-manager-roles-csv-import'),
114
        url(
115
            r'^roles/csv-import-sample/$',
113
        path('roles/', role_views.listing, name='a2-manager-roles'),
114
        path('roles/import/', role_views.roles_import, name='a2-manager-roles-import'),
115
        path('roles/csv-import/', role_views.roles_csv_import, name='a2-manager-roles-csv-import'),
116
        path(
117
            'roles/csv-import-sample/',
116 118
            role_views.roles_csv_import_sample,
117 119
            name='a2-manager-roles-csv-import-sample',
118 120
        ),
119
        url(r'^roles/add/$', role_views.add, name='a2-manager-role-add'),
120
        url(r'^roles/export/(?P<format>csv|json)/$', role_views.export, name='a2-manager-roles-export'),
121
        url(r'^roles/journal/$', role_views.roles_journal, name='a2-manager-roles-journal'),
122
        url(r'^roles/(?P<pk>\d+)/$', role_views.members, name='a2-manager-role-members'),
123
        url(r'^roles/uuid:(?P<slug>[a-z0-9]+)/$', role_views.members, name='a2-manager-roles-by-uuid-detail'),
124
        url(r'^roles/(?P<pk>\d+)/children/$', role_views.children, name='a2-manager-role-children'),
125
        url(r'^roles/(?P<pk>\d+)/parents/$', role_views.parents, name='a2-manager-role-parents'),
126
        url(
127
            r'^roles/(?P<pk>\d+)/add-admin-user/$',
121
        path('roles/add/', role_views.add, name='a2-manager-role-add'),
122
        re_path(r'^roles/export/(?P<format>csv|json)/$', role_views.export, name='a2-manager-roles-export'),
123
        path('roles/journal/', role_views.roles_journal, name='a2-manager-roles-journal'),
124
        path('roles/<int:pk>/', role_views.members, name='a2-manager-role-members'),
125
        re_path(
126
            r'^roles/uuid:(?P<slug>[a-z0-9]+)/$', role_views.members, name='a2-manager-roles-by-uuid-detail'
127
        ),
128
        path('roles/<int:pk>/children/', role_views.children, name='a2-manager-role-children'),
129
        path('roles/<int:pk>/parents/', role_views.parents, name='a2-manager-role-parents'),
130
        path(
131
            'roles/<int:pk>/add-admin-user/',
128 132
            role_views.add_admin_user,
129 133
            name='a2-manager-role-add-admin-user',
130 134
        ),
131
        url(
132
            r'^roles/(?P<pk>\d+)/remove-admin-user/(?P<user_pk>\d+)/$',
135
        path(
136
            'roles/<int:pk>/remove-admin-user/<int:user_pk>/',
133 137
            role_views.remove_admin_user,
134 138
            name='a2-manager-role-remove-admin-user',
135 139
        ),
136
        url(
137
            r'^roles/(?P<pk>\d+)/add-admin-role/$',
140
        path(
141
            'roles/<int:pk>/add-admin-role/',
138 142
            role_views.add_admin_role,
139 143
            name='a2-manager-role-add-admin-role',
140 144
        ),
141
        url(
142
            r'^roles/(?P<pk>\d+)/remove-admin-role/(?P<role_pk>\d+)/$',
145
        path(
146
            'roles/<int:pk>/remove-admin-role/<int:role_pk>/',
143 147
            role_views.remove_admin_role,
144 148
            name='a2-manager-role-remove-admin-role',
145 149
        ),
146
        url(
150
        re_path(
147 151
            r'^roles/(?P<pk>\d+)/export/(?P<format>csv)/$',
148 152
            role_views.members_export,
149 153
            name='a2-manager-role-members-export',
150 154
        ),
151
        url(r'^roles/(?P<pk>\d+)/delete/$', role_views.delete, name='a2-manager-role-delete'),
152
        url(r'^roles/(?P<pk>\d+)/edit/$', role_views.edit, name='a2-manager-role-edit'),
153
        url(r'^roles/(?P<pk>\d+)/permissions/$', role_views.permissions, name='a2-manager-role-permissions'),
154
        url(r'^roles/(?P<pk>\d+)/journal/$', role_views.journal, name='a2-manager-role-journal'),
155
        url(
155
        path('roles/<int:pk>/delete/', role_views.delete, name='a2-manager-role-delete'),
156
        path('roles/<int:pk>/edit/', role_views.edit, name='a2-manager-role-edit'),
157
        path('roles/<int:pk>/permissions/', role_views.permissions, name='a2-manager-role-permissions'),
158
        path('roles/<int:pk>/journal/', role_views.journal, name='a2-manager-role-journal'),
159
        re_path(
156 160
            r'^roles/(?P<pk>\d+)/user-or-role-select2.json$',
157 161
            role_views.user_or_role_select2,
158 162
            name='user-or-role-select2-json',
159 163
        ),
160 164
        # Authentic2 organizational units
161
        url(r'^organizational-units/$', ou_views.listing, name='a2-manager-ous'),
162
        url(r'^organizational-units/add/$', ou_views.add, name='a2-manager-ou-add'),
163
        url(r'^organizational-units/(?P<pk>\d+)/$', ou_views.detail, name='a2-manager-ou-detail'),
164
        url(r'^organizational-units/(?P<pk>\d+)/edit/$', ou_views.edit, name='a2-manager-ou-edit'),
165
        url(r'^organizational-units/(?P<pk>\d+)/delete/$', ou_views.delete, name='a2-manager-ou-delete'),
166
        url(r'^organizational-units/export/(?P<format>json)/$', ou_views.export, name='a2-manager-ou-export'),
167
        url(r'^organizational-units/import/$', ou_views.ous_import, name='a2-manager-ous-import'),
165
        path('organizational-units/', ou_views.listing, name='a2-manager-ous'),
166
        path('organizational-units/add/', ou_views.add, name='a2-manager-ou-add'),
167
        path('organizational-units/<int:pk>/', ou_views.detail, name='a2-manager-ou-detail'),
168
        path('organizational-units/<int:pk>/edit/', ou_views.edit, name='a2-manager-ou-edit'),
169
        path('organizational-units/<int:pk>/delete/', ou_views.delete, name='a2-manager-ou-delete'),
170
        re_path(
171
            r'^organizational-units/export/(?P<format>json)/$', ou_views.export, name='a2-manager-ou-export'
172
        ),
173
        path('organizational-units/import/', ou_views.ous_import, name='a2-manager-ous-import'),
168 174
        # Services
169
        url(r'^services/$', service_views.listing, name='a2-manager-services'),
170
        url(r'^services/(?P<service_pk>\d+)/$', service_views.service_detail, name='a2-manager-service'),
171
        url(
172
            r'^services/(?P<service_pk>\d+)/settings/$',
175
        path('services/', service_views.listing, name='a2-manager-services'),
176
        path('services/<int:service_pk>/', service_views.service_detail, name='a2-manager-service'),
177
        path(
178
            'services/<int:service_pk>/settings/',
173 179
            service_views.service_settings,
174 180
            name='a2-manager-service-settings',
175 181
        ),
176
        url(
177
            r'^services/(?P<service_pk>\d+)/settings/edit/$',
182
        path(
183
            'services/<int:service_pk>/settings/edit/',
178 184
            service_views.edit_service,
179 185
            name='a2-manager-service-settings-edit',
180 186
        ),
181
        url(
182
            r'^services/(?P<service_pk>\d+)/delete/$',
187
        path(
188
            'services/<int:service_pk>/delete/',
183 189
            service_views.delete_service,
184 190
            name='a2-manager-service-delete',
185 191
        ),  # Journal
186
        url(r'^journal/$', journal_views.journal, name='a2-manager-journal'),
187
        url(
188
            r'^journal/event-types/$',
192
        path('journal/', journal_views.journal, name='a2-manager-journal'),
193
        path(
194
            'journal/event-types/',
189 195
            journal_views.journal_event_types,
190 196
            name='a2-manager-journal-event-types',
191 197
        ),
192 198
        # backoffice menu as json
193
        url(r'^menu.json$', views.menu_json),
199
        re_path(r'^menu.json$', views.menu_json),
194 200
        # general management
195
        url(r'^site-export/$', views.site_export, name='a2-manager-site-export'),
196
        url(r'^site-import/$', views.site_import, name='a2-manager-site-import'),
201
        path('site-export/', views.site_export, name='a2-manager-site-export'),
202
        path('site-import/', views.site_import, name='a2-manager-site-import'),
197 203
        # technical information including ldap config
198
        url(r'^tech-info/$', views.tech_info, name='a2-manager-tech-info'),
199
        url(r'^api-clients/$', views.api_clients, name='a2-manager-api-clients'),
200
        url(r'^api-clients/add/$', views.api_client_add, name='a2-manager-api-client-add'),
201
        url(r'^api-clients/(?P<pk>\d+)/$', views.api_client_detail, name='a2-manager-api-client-detail'),
202
        url(r'^api-clients/(?P<pk>\d+)/edit/$', views.api_client_edit, name='a2-manager-api-client-edit'),
203
        url(
204
            r'^api-clients/(?P<pk>\d+)/delete/$', views.api_client_delete, name='a2-manager-api-client-delete'
205
        ),
204
        path('tech-info/', views.tech_info, name='a2-manager-tech-info'),
205
        path('api-clients/', views.api_clients, name='a2-manager-api-clients'),
206
        path('api-clients/add/', views.api_client_add, name='a2-manager-api-client-add'),
207
        path('api-clients/<int:pk>/', views.api_client_detail, name='a2-manager-api-client-detail'),
208
        path('api-clients/<int:pk>/edit/', views.api_client_edit, name='a2-manager-api-client-edit'),
209
        path('api-clients/<int:pk>/delete/', views.api_client_delete, name='a2-manager-api-client-delete'),
206 210
    ],
207 211
)
208 212

  
......
210 214
urlpatterns += oidc_manager_urlpatterns
211 215

  
212 216
urlpatterns += [
213
    url(
214
        r'^jsi18n/$',
217
    path(
218
        'jsi18n/',
215 219
        JavaScriptCatalog.as_view(packages=['authentic2.manager']),
216 220
        name='a2-manager-javascript-catalog',
217 221
    ),
218
    url(r'^select2.json$', views.select2, name='django_select2-json'),
222
    re_path(r'^select2.json$', views.select2, name='django_select2-json'),
219 223
]
src/authentic2/middleware.py
208 208

  
209 209
    def process_request(self, request):
210 210
        if 'HTTP_X_FORWARDED_FOR' in request.META:
211
            request.META['REMOTE_ADDR'] = request.META['HTTP_X_FORWARDED_FOR'].split(",")[0].strip()
211
            request.META['REMOTE_ADDR'] = request.headers['X-Forwarded-For'].split(",")[0].strip()
212 212
            return None
213 213

  
214 214

  
src/authentic2/saml/admin.py
18 18

  
19 19
from django import forms
20 20
from django.conf import settings
21
from django.conf.urls import url
22 21
from django.contrib import admin, messages
23 22
from django.core.exceptions import ValidationError
24 23
from django.forms import ModelForm
24
from django.urls import path
25 25
from django.utils.translation import ugettext as _
26 26

  
27 27
try:
......
171 171
    def get_urls(self):
172 172
        urls = super().get_urls()
173 173
        urls = [
174
            url(
175
                r'^add-from-url/$',
174
            path(
175
                'add-from-url/',
176 176
                self.admin_site.admin_view(
177 177
                    admin_views.AddLibertyProviderFromUrlView.as_view(model_admin=self)
178 178
                ),
src/authentic2/saml/common.py
510 510
    else:
511 511
        logging.error('Showing message %r on an error page', message)
512 512
    if back is None:
513
        referer = request.META.get('HTTP_REFERER')
513
        referer = request.headers.get('Referer')
514 514
        if referer:
515 515
            root_referer = __root_refererer_re.match(referer)
516 516
            if root_referer:
src/authentic2/urls.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
from django.conf import settings
18
from django.conf.urls import include, url
19 18
from django.contrib import admin
20 19
from django.contrib.auth import views as dj_auth_views
21 20
from django.contrib.auth.decorators import login_required
22 21
from django.contrib.staticfiles.views import serve
22
from django.urls import include, path, re_path
23 23
from django.utils.translation import ugettext_lazy as _
24 24
from django.views.decorators.clickjacking import xframe_options_deny
25 25
from django.views.generic import RedirectView
......
39 39
admin.autodiscover()
40 40

  
41 41
accounts_urlpatterns = [
42
    url(
42
    re_path(
43 43
        r'^activate/(?P<registration_token>[A-Za-z0-9_ -]+)/$',
44 44
        views.registration_completion,
45 45
        name='registration_activate',
46 46
    ),
47
    url(r'^delete/$', login_required(views.AccountDeleteView.as_view()), name='delete_account'),
48
    url(
47
    path('delete/', login_required(views.AccountDeleteView.as_view()), name='delete_account'),
48
    re_path(
49 49
        r'validate-deletion/(?P<deletion_token>[\w: -]+)/$',
50 50
        views.ValidateDeletionView.as_view(),
51 51
        name='validate_deletion',
52 52
    ),
53
    url(r'^logged-in/$', views.logged_in, name='logged-in'),
54
    url(r'^edit/$', views.edit_profile, name='profile_edit'),
55
    url(r'^edit/required/$', views.edit_required_profile, name='profile_required_edit'),
56
    url(r'^edit/(?P<scope>[-\w]+)/$', views.edit_profile, name='profile_edit_with_scope'),
57
    url(r'^change-email/$', views.email_change, name='email-change'),
58
    url(r'^change-email/verify/$', views.email_change_verify, name='email-change-verify'),
59
    url(
60
        r'^consents/$',
53
    path('logged-in/', views.logged_in, name='logged-in'),
54
    path('edit/', views.edit_profile, name='profile_edit'),
55
    path('edit/required/', views.edit_required_profile, name='profile_required_edit'),
56
    re_path(r'^edit/(?P<scope>[-\w]+)/$', views.edit_profile, name='profile_edit_with_scope'),
57
    path('change-email/', views.email_change, name='email-change'),
58
    path('change-email/verify/', views.email_change_verify, name='email-change-verify'),
59
    path(
60
        'consents/',
61 61
        login_required(views.consents),
62 62
        name='consents',
63 63
    ),
64
    url(
65
        r'^consents/(?P<pk>\d+)/delete/$',
64
    path(
65
        'consents/<int:pk>/delete/',
66 66
        login_required(views.consent_delete),
67 67
        name='consent-delete',
68 68
    ),
69
    url(r'^$', views.profile, name='account_management'),
69
    path('', views.profile, name='account_management'),
70 70
    # Password change
71
    url(r'^password/change/$', views.password_change, name='password_change'),
72
    url(
73
        r'^password/change/done/$',
71
    path('password/change/', views.password_change, name='password_change'),
72
    path(
73
        'password/change/done/',
74 74
        dj_auth_views.PasswordChangeDoneView.as_view(),
75 75
        name='password_change_done',
76 76
    ),
77 77
    # permament redirections for views moved to root
78
    url(r'^register/$', RedirectView.as_view(permanent=True, pattern_name='registration_register')),
79
    url(r'^register/complete/$', RedirectView.as_view(permanent=True, pattern_name='registration_complete')),
80
    url(r'^register/closed/$', RedirectView.as_view(permanent=True, pattern_name='registration_disallowed')),
81
    url(
78
    path('register/', RedirectView.as_view(permanent=True, pattern_name='registration_register')),
79
    path('register/complete/', RedirectView.as_view(permanent=True, pattern_name='registration_complete')),
80
    path('register/closed/', RedirectView.as_view(permanent=True, pattern_name='registration_disallowed')),
81
    re_path(
82 82
        r'^password/reset/confirm/(?P<token>[A-Za-z0-9_ -]+)/$',
83 83
        RedirectView.as_view(permanent=True, pattern_name='password_reset_confirm'),
84 84
    ),
85
    url(r'^password/reset/$', RedirectView.as_view(permanent=True, pattern_name='password_reset')),
86
    url(
87
        r'^password/reset/instructions/$',
85
    path('password/reset/', RedirectView.as_view(permanent=True, pattern_name='password_reset')),
86
    path(
87
        'password/reset/instructions/',
88 88
        RedirectView.as_view(permanent=True, pattern_name='password_reset_instructions'),
89 89
    ),
90
    url(
90
    re_path(
91 91
        r'^password/reset/.*',
92 92
        RedirectView.as_view(permanent=True, pattern_name='invalid-password-reset-urls'),
93 93
    ),
94 94
]
95 95

  
96 96
urlpatterns = [
97
    url(r'^$', views.homepage, name='auth_homepage'),
98
    url(r'^login/$', views.login, name='auth_login'),
99
    url(r'^login/token/(?P<token>[A-Za-z0-9_ -]+)/$', views.token_login, name='token_login'),
100
    url(r'^logout/$', views.logout, name='auth_logout'),
101
    url(r'^su/(?P<uuid>[A-Za-z0-9_-]+)/$', views.su, name='su'),
102
    url(r'^accounts/', include(accounts_urlpatterns)),
103
    url(r'^admin/', admin.site.urls),
104
    url(r'^idp/', include('authentic2.idp.urls')),
105
    url(r'^manage/', include('authentic2.manager.urls')),
106
    url(r'^api/', include('authentic2.api_urls')),
107
    url(r'^continue/$', views.display_message_and_continue, name='continue'),
108
    url(r'^\.well-known/change-password$', RedirectView.as_view(pattern_name='password_change')),
97
    path('', views.homepage, name='auth_homepage'),
98
    path('login/', views.login, name='auth_login'),
99
    re_path(r'^login/token/(?P<token>[A-Za-z0-9_ -]+)/$', views.token_login, name='token_login'),
100
    path('logout/', views.logout, name='auth_logout'),
101
    re_path(r'^su/(?P<uuid>[A-Za-z0-9_-]+)/$', views.su, name='su'),
102
    re_path(r'^accounts/', include(accounts_urlpatterns)),
103
    re_path(r'^admin/', admin.site.urls),
104
    re_path(r'^idp/', include('authentic2.idp.urls')),
105
    re_path(r'^manage/', include('authentic2.manager.urls')),
106
    re_path(r'^api/', include('authentic2.api_urls')),
107
    path('continue/', views.display_message_and_continue, name='continue'),
108
    re_path(r'^\.well-known/change-password$', RedirectView.as_view(pattern_name='password_change')),
109 109
    # Registration
110
    url(r'^register/$', views.RegistrationView.as_view(), name='registration_register'),
111
    url(r'^register/complete/$', views.registration_complete, name='registration_complete'),
112
    url(
113
        r'^register/closed/$',
110
    path('register/', views.RegistrationView.as_view(), name='registration_register'),
111
    path('register/complete/', views.registration_complete, name='registration_complete'),
112
    path(
113
        'register/closed/',
114 114
        TemplateView.as_view(template_name='registration/registration_closed.html'),
115 115
        name='registration_disallowed',
116 116
    ),
117 117
    # Password reset
118
    url(
118
    re_path(
119 119
        r'^password/reset/confirm/(?P<token>[A-Za-z0-9_ -]+)/$',
120 120
        views.password_reset_confirm,
121 121
        name='password_reset_confirm',
122 122
    ),
123
    url(r'^password/reset/$', views.password_reset, name='password_reset'),
124
    url(
125
        r'^password/reset/instructions/$',
123
    path('password/reset/', views.password_reset, name='password_reset'),
124
    path(
125
        'password/reset/instructions/',
126 126
        views.password_reset_instructions,
127 127
        name='password_reset_instructions',
128 128
    ),
129
    url(
129
    re_path(
130 130
        r'^password/reset/.*',
131 131
        views.old_view_redirect,
132 132
        kwargs={
......
146 146
    pass
147 147

  
148 148
if settings.DEBUG:
149
    urlpatterns += [url(r'^static/(?P<path>.*)$', serve)]
150
    urlpatterns += [url(r'^media/(?P<path>.*)$', media_serve, {'document_root': settings.MEDIA_ROOT})]
149
    urlpatterns += [re_path(r'^static/(?P<path>.*)$', serve)]
150
    urlpatterns += [re_path(r'^media/(?P<path>.*)$', media_serve, {'document_root': settings.MEDIA_ROOT})]
151 151

  
152 152
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
153 153
    import debug_toolbar  # pylint: disable=import-error
154 154

  
155 155
    urlpatterns = [
156
        url(r'^__debug__/', include(debug_toolbar.urls)),
156
        re_path(r'^__debug__/', include(debug_toolbar.urls)),
157 157
    ] + urlpatterns
158 158

  
159 159
# prevent click-jacking on authentic views
......
163 163

  
164 164
authentic2_idp_saml_urls = required(
165 165
    (setting_enabled('ENABLE', settings=authentic2.idp.saml.app_settings), lasso_required()),
166
    [url(r'^idp/saml2/', include('authentic2.idp.saml.urls'))],
166
    [re_path(r'^idp/saml2/', include('authentic2.idp.saml.urls'))],
167 167
)
168 168

  
169 169
authentic2_idp_cas_urls = required(
170 170
    (setting_enabled('ENABLE', settings=authentic2_idp_cas.app_settings),),
171
    [url(r'^idp/cas/', include('authentic2_idp_cas.urls'))],
171
    [re_path(r'^idp/cas/', include('authentic2_idp_cas.urls'))],
172 172
)
173 173

  
174 174
urlpatterns = (
src/authentic2/utils/misc.py
550 550
    """
551 551
    if skip_post and request.method == 'POST':
552 552
        return True
553
    referer = request.META.get('HTTP_REFERER')
553
    referer = request.headers.get('Referer')
554 554
    return referer and same_origin(request.build_absolute_uri(), referer)
555 555

  
556 556

  
src/authentic2/views.py
778 778

  
779 779
    def check_referrer(self):
780 780
        '''Check if the given referer is authorized'''
781
        referer = self.request.META.get('HTTP_REFERER', '')
781
        referer = self.request.headers.get('Referer', '')
782 782
        for valid_referer in app_settings.VALID_REFERERS:
783 783
            if referer.startswith(valid_referer):
784 784
                return True
src/authentic2_auth_fc/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import include, url
17
from django.urls import include, path, re_path
18 18

  
19 19
from . import views
20 20

  
21 21
fcpatterns = [
22
    url(r'^callback/$', views.login_or_link, name='fc-login-or-link'),
23
    url(r'^callback_logout/$', views.logout, name='fc-logout'),
22
    path('callback/', views.login_or_link, name='fc-login-or-link'),
23
    path('callback_logout/', views.logout, name='fc-logout'),
24 24
]
25 25

  
26 26
urlpatterns = [
27
    url(r'^fc/', include(fcpatterns)),
28
    url(r'^accounts/fc/unlink/$', views.unlink, name='fc-unlink'),
27
    re_path(r'^fc/', include(fcpatterns)),
28
    path('accounts/fc/unlink/', views.unlink, name='fc-unlink'),
29 29
]
src/authentic2_auth_oidc/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
18 17
from django.urls import path
19 18

  
20 19
from authentic2.apps.authenticators.manager_urls import superuser_login_required
......
23 22
from . import views
24 23

  
25 24
urlpatterns = [
26
    url(r'^accounts/oidc/login/(?P<pk>\d+)/$', views.oidc_login, name='oidc-login'),
27
    url(r'^accounts/oidc/login/$', views.login_initiate, name='oidc-login-initiate'),
28
    url(r'^accounts/oidc/callback/$', views.login_callback, name='oidc-login-callback'),
25
    path('accounts/oidc/login/<int:pk>/', views.oidc_login, name='oidc-login'),
26
    path('accounts/oidc/login/', views.login_initiate, name='oidc-login-initiate'),
27
    path('accounts/oidc/callback/', views.login_callback, name='oidc-login-callback'),
29 28
]
30 29

  
31 30
urlpatterns += required(
src/authentic2_auth_saml/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import include, url
18
from django.urls import path
17
from django.urls import include, path, re_path
19 18

  
20 19
from authentic2.apps.authenticators.manager_urls import superuser_login_required
21 20
from authentic2.decorators import required
......
23 22
from . import views
24 23

  
25 24
urlpatterns = [
26
    url(r'^accounts/saml/', include('mellon.urls'), kwargs={'template_base': 'authentic2/base.html'})
25
    re_path(r'^accounts/saml/', include('mellon.urls'), kwargs={'template_base': 'authentic2/base.html'})
27 26
]
28 27

  
29 28
urlpatterns += required(
src/authentic2_idp_cas/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path, re_path
18 18

  
19 19
from . import views
20 20

  
21 21
urlpatterns = [
22
    url('^login/?$', views.login, name='a2-idp-cas-login'),
23
    url('^continue/$', views._continue, name='a2-idp-cas-continue'),
24
    url('^validate/?$', views.validate, name='a2-idp-cas-validate'),
25
    url('^serviceValidate/?$', views.service_validate, name='a2-idp-cas-service-validate'),
26
    url('^logout/?$', views.logout, name='a2-idp-cas-logout'),
27
    url('^proxy/?$', views.proxy, name='a2-idp-cas-proxy'),
28
    url('^proxyValidate/?$', views.proxy_validate, name='a2-idp-cas-proxy-validate'),
22
    re_path('^login/?$', views.login, name='a2-idp-cas-login'),
23
    path('continue/', views._continue, name='a2-idp-cas-continue'),
24
    re_path('^validate/?$', views.validate, name='a2-idp-cas-validate'),
25
    re_path('^serviceValidate/?$', views.service_validate, name='a2-idp-cas-service-validate'),
26
    re_path('^logout/?$', views.logout, name='a2-idp-cas-logout'),
27
    re_path('^proxy/?$', views.proxy, name='a2-idp-cas-proxy'),
28
    re_path('^proxyValidate/?$', views.proxy_validate, name='a2-idp-cas-proxy-validate'),
29 29
]
src/authentic2_idp_oidc/manager/urls.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17

  
18
from django.conf.urls import url
18
from django.urls import path
19 19

  
20 20
from authentic2.decorators import required
21 21
from authentic2.manager.utils import manager_login_required
......
25 25
urlpatterns = required(
26 26
    manager_login_required,
27 27
    [
28
        url(r'^services/add-oidc/$', views.add_oidc_service, name='a2-manager-add-oidc-service'),
29
        url(
30
            r'^services/(?P<service_pk>\d+)/claim/add/$',
28
        path('services/add-oidc/', views.add_oidc_service, name='a2-manager-add-oidc-service'),
29
        path(
30
            'services/<int:service_pk>/claim/add/',
31 31
            views.oidc_claim_add,
32 32
            name='a2-manager-oidc-claim-add',
33 33
        ),
34
        url(
35
            r'^services/(?P<service_pk>\d+)/claim/(?P<claim_pk>\d+)/edit/$',
34
        path(
35
            'services/<int:service_pk>/claim/<int:claim_pk>/edit/',
36 36
            views.oidc_claim_edit,
37 37
            name='a2-manager-oidc-claim-edit',
38 38
        ),
39
        url(
40
            r'^services/(?P<service_pk>\d+)/claim/(?P<claim_pk>\d+)/delete/$',
39
        path(
40
            'services/<int:service_pk>/claim/<int:claim_pk>/delete/',
41 41
            views.oidc_claim_delete,
42 42
            name='a2-manager-oidc-claim-delete',
43 43
        ),
src/authentic2_idp_oidc/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import re_path
18 18

  
19 19
from . import views
20 20

  
21 21
urlpatterns = [
22
    url(r'^.well-known/openid-configuration$', views.openid_configuration, name='oidc-openid-configuration'),
23
    url(r'^idp/oidc/certs/?$', views.certs, name='oidc-certs'),
24
    url(r'^idp/oidc/authorize/?$', views.authorize, name='oidc-authorize'),
25
    url(r'^idp/oidc/token/?$', views.token, name='oidc-token'),
26
    url(r'^idp/oidc/user_info/?$', views.user_info, name='oidc-user-info'),
27
    url(r'^idp/oidc/logout/?$', views.logout, name='oidc-logout'),
22
    re_path(
23
        r'^.well-known/openid-configuration$', views.openid_configuration, name='oidc-openid-configuration'
24
    ),
25
    re_path(r'^idp/oidc/certs/?$', views.certs, name='oidc-certs'),
26
    re_path(r'^idp/oidc/authorize/?$', views.authorize, name='oidc-authorize'),
27
    re_path(r'^idp/oidc/token/?$', views.token, name='oidc-token'),
28
    re_path(r'^idp/oidc/user_info/?$', views.user_info, name='oidc-user-info'),
29
    re_path(r'^idp/oidc/logout/?$', views.logout, name='oidc-logout'),
28 30
]
src/authentic2_idp_oidc/views.py
535 535

  
536 536

  
537 537
def parse_http_basic(request):
538
    authorization = request.META['HTTP_AUTHORIZATION'].split()
538
    authorization = request.headers['Authorization'].split()
539 539
    if authorization[0] != 'Basic' or len(authorization) != 2:
540 540
        return None, None
541 541
    try:
......
817 817
def authenticate_access_token(request):
818 818
    if 'HTTP_AUTHORIZATION' not in request.META:
819 819
        raise InvalidRequest(_('Bearer authentication is mandatory'), status=401)
820
    authorization = request.META['HTTP_AUTHORIZATION'].split()
820
    authorization = request.headers['Authorization'].split()
821 821
    if authorization[0] != 'Bearer' or len(authorization) != 2:
822 822
        raise InvalidRequest(_('Invalid Bearer authentication'), status=401)
823 823
    try:
tests/cache_urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
18 17
from django.http import HttpResponse
18
from django.urls import path
19 19

  
20 20
from authentic2.utils.cache import SessionCache
21 21

  
......
32 32
    return HttpResponse('%s' % value)
33 33

  
34 34

  
35
urlpatterns = [url(r'^session_cache/$', session_cache)]
35
urlpatterns = [path('session_cache/', session_cache)]
tests/conftest.py
20 20
import urllib.parse
21 21
from unittest import mock
22 22

  
23
import django
24 23
import django_webtest
25 24
import pytest
26 25
from django.contrib.auth import get_user_model
......
448 447
@pytest.fixture()
449 448
def migration(request, transactional_db):
450 449
    # see https://gist.github.com/asfaltboy/b3e6f9b5d95af8ba2cc46f2ba6eae5e2
451
    if django.VERSION < (1, 9):
452
        pytest.skip('migration fixture only works with Django 1.9')
453
    # pylint: disable=pointless-string-statement
454 450
    """
455 451
    This fixture returns a helper object to test Django data migrations.
456 452
    The fixture returns an object with two methods;
tests/test_journal_app/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import re_path
18 18

  
19 19
from . import views
20 20

  
21 21
urlpatterns = [
22
    url('^login/(?P<name>[^/]+)/', views.login_view),
22
    re_path('^login/(?P<name>[^/]+)/', views.login_view),
23 23
]
24
-