django.conf.urls is deprecated and will be removed in Django 4.0, use django.urls.re_path instead

Signed-off-by: Yohann D'ANELLO <ynerant@¢rans.org>
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
Yohann D'ANELLO 2020-12-22 23:07:33 +01:00
parent 10b389e7be
commit d62def6d6b
No known key found for this signature in database
GPG key ID: 3A75C55819C8CF85
2 changed files with 35 additions and 14 deletions

View file

@ -13,10 +13,20 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
import django
if django.VERSION < (2,):
from django.conf.urls import url
re_path = url
else:
from django.urls import re_path
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('cas_server.urls', namespace='cas_server')),
re_path(r'^admin/', admin.site.urls),
re_path(r'^', include('cas_server.urls', namespace='cas_server')),
]

View file

@ -10,6 +10,16 @@
#
# (c) 2015-2016 Valentin Samir
"""urls for the app"""
import django
if django.VERSION < (2,):
from django.conf.urls import url
re_path = url
else:
from django.urls import re_path
from django.conf.urls import url
from django.views.generic import RedirectView
from django.views.decorators.debug import sensitive_post_parameters, sensitive_variables
@ -19,42 +29,42 @@ from cas_server import views
app_name = "cas_server"
urlpatterns = [
url(
re_path(
r'^$',
RedirectView.as_view(pattern_name="cas_server:login", permanent=False, query_string=True)
),
url(
re_path(
'^login$',
sensitive_post_parameters('password')(
views.LoginView.as_view()
),
name='login'
),
url('^logout$', views.LogoutView.as_view(), name='logout'),
url('^validate$', views.Validate.as_view(), name='validate'),
url(
re_path('^logout$', views.LogoutView.as_view(), name='logout'),
re_path('^validate$', views.Validate.as_view(), name='validate'),
re_path(
'^serviceValidate$',
views.ValidateService.as_view(allow_proxy_ticket=False),
name='serviceValidate'
),
url(
re_path(
'^proxyValidate$',
views.ValidateService.as_view(allow_proxy_ticket=True),
name='proxyValidate'
),
url('^proxy$', views.Proxy.as_view(), name='proxy'),
url(
re_path('^proxy$', views.Proxy.as_view(), name='proxy'),
re_path(
'^p3/serviceValidate$',
views.ValidateService.as_view(allow_proxy_ticket=False),
name='p3_serviceValidate'
),
url(
re_path(
'^p3/proxyValidate$',
views.ValidateService.as_view(allow_proxy_ticket=True),
name='p3_proxyValidate'
),
url('^samlValidate$', views.SamlValidate.as_view(), name='samlValidate'),
url(
re_path('^samlValidate$', views.SamlValidate.as_view(), name='samlValidate'),
re_path(
'^auth$',
sensitive_variables('password', 'secret')(
sensitive_post_parameters('password', 'secret')(
@ -63,5 +73,6 @@ urlpatterns = [
),
name='auth'
),
url("^federate(?:/(?P<provider>([^/]+)))?$", views.FederateAuth.as_view(), name='federateAuth'),
re_path("^federate(?:/(?P<provider>([^/]+)))?$",
views.FederateAuth.as_view(), name='federateAuth'),
]