From c7b99044bcec8cdf6de284a08a5a678d1cdd16b4 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 2 Feb 2022 21:39:37 +1000 Subject: [PATCH] django.conf.urls.url is deprecated, more to fix --- allianceauth/authentication/hmac_urls.py | 15 ++++++------ allianceauth/authentication/signals.py | 2 +- allianceauth/authentication/urls.py | 12 +++++----- allianceauth/corputils/urls.py | 13 +++++------ allianceauth/fleetactivitytracking/urls.py | 26 ++++++++++----------- allianceauth/urls.py | 27 +++++++++++----------- 6 files changed, 48 insertions(+), 47 deletions(-) diff --git a/allianceauth/authentication/hmac_urls.py b/allianceauth/authentication/hmac_urls.py index edf7b973..2157bd27 100644 --- a/allianceauth/authentication/hmac_urls.py +++ b/allianceauth/authentication/hmac_urls.py @@ -1,14 +1,15 @@ -from django.conf.urls import url, include +from django.conf.urls import include from allianceauth.authentication import views +from django.urls import re_path urlpatterns = [ - url(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'), + re_path(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'), # The activation key can make use of any character from the # URL-safe base64 alphabet, plus the colon as a separator. - url(r'^activate/(?P[-:\w]+)/$', views.ActivationView.as_view(), name='registration_activate'), - url(r'^register/$', views.RegistrationView.as_view(), name='registration_register'), - url(r'^register/complete/$', views.registration_complete, name='registration_complete'), - url(r'^register/closed/$', views.registration_closed, name='registration_disallowed'), - url(r'', include('django.contrib.auth.urls')), + re_path(r'^activate/(?P[-:\w]+)/$', views.ActivationView.as_view(), name='registration_activate'), + re_path(r'^register/$', views.RegistrationView.as_view(), name='registration_register'), + re_path(r'^register/complete/$', views.registration_complete, name='registration_complete'), + re_path(r'^register/closed/$', views.registration_closed, name='registration_disallowed'), + re_path(r'', include('django.contrib.auth.urls')), ] diff --git a/allianceauth/authentication/signals.py b/allianceauth/authentication/signals.py index f007c838..cf103f18 100644 --- a/allianceauth/authentication/signals.py +++ b/allianceauth/authentication/signals.py @@ -11,7 +11,7 @@ from allianceauth.eveonline.models import EveCharacter logger = logging.getLogger(__name__) -state_changed = Signal(providing_args=['user', 'state']) +state_changed = Signal() def trigger_state_check(state): diff --git a/allianceauth/authentication/urls.py b/allianceauth/authentication/urls.py index 3f917f45..102b95bb 100644 --- a/allianceauth/authentication/urls.py +++ b/allianceauth/authentication/urls.py @@ -1,5 +1,5 @@ -from django.conf.urls import url from django.contrib.auth.decorators import login_required +from django.urls import re_path from django.views.generic.base import TemplateView from . import views @@ -7,21 +7,21 @@ from . import views app_name = 'authentication' urlpatterns = [ - url(r'^$', views.index, name='index'), - url( + re_path(r'^$', views.index, name='index'), + re_path( r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='login' ), - url( + re_path( r'^account/characters/main/$', views.main_character_change, name='change_main_character' ), - url( + re_path( r'^account/characters/add/$', views.add_character, name='add_character' ), - url(r'^dashboard/$', views.dashboard, name='dashboard'), + re_path(r'^dashboard/$', views.dashboard, name='dashboard'), ] diff --git a/allianceauth/corputils/urls.py b/allianceauth/corputils/urls.py index fe52474c..64504ede 100644 --- a/allianceauth/corputils/urls.py +++ b/allianceauth/corputils/urls.py @@ -1,12 +1,11 @@ -from django.conf.urls import url - +from django.urls import re_path from . import views app_name = 'corputils' urlpatterns = [ - url(r'^$', views.corpstats_view, name='view'), - url(r'^add/$', views.corpstats_add, name='add'), - url(r'^(?P(\d)*)/$', views.corpstats_view, name='view_corp'), - url(r'^(?P(\d)+)/update/$', views.corpstats_update, name='update'), - url(r'^search/$', views.corpstats_search, name='search'), + re_path(r'^$', views.corpstats_view, name='view'), + re_path(r'^add/$', views.corpstats_add, name='add'), + re_path(r'^(?P(\d)*)/$', views.corpstats_view, name='view_corp'), + re_path(r'^(?P(\d)+)/update/$', views.corpstats_update, name='update'), + re_path(r'^search/$', views.corpstats_search, name='search'), ] diff --git a/allianceauth/fleetactivitytracking/urls.py b/allianceauth/fleetactivitytracking/urls.py index 84ad961b..6d270559 100644 --- a/allianceauth/fleetactivitytracking/urls.py +++ b/allianceauth/fleetactivitytracking/urls.py @@ -1,30 +1,30 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'fleetactivitytracking' urlpatterns = [ # FleetActivityTracking (FAT) - url(r'^$', views.fatlink_view, name='view'), - url(r'^statistics/$', views.fatlink_statistics_view, name='statistics'), - url(r'^statistics/corp/(\w+)$', views.fatlink_statistics_corp_view, + re_path(r'^$', views.fatlink_view, name='view'), + re_path(r'^statistics/$', views.fatlink_statistics_view, name='statistics'), + re_path(r'^statistics/corp/(\w+)$', views.fatlink_statistics_corp_view, name='statistics_corp'), - url(r'^statistics/corp/(?P\w+)/(?P[0-9]+)/(?P[0-9]+)/', + re_path(r'^statistics/corp/(?P\w+)/(?P[0-9]+)/(?P[0-9]+)/', views.fatlink_statistics_corp_view, name='statistics_corp_month'), - url(r'^statistics/(?P[0-9]+)/(?P[0-9]+)/$', views.fatlink_statistics_view, + re_path(r'^statistics/(?P[0-9]+)/(?P[0-9]+)/$', views.fatlink_statistics_view, name='statistics_month'), - url(r'^user/statistics/$', views.fatlink_personal_statistics_view, + re_path(r'^user/statistics/$', views.fatlink_personal_statistics_view, name='personal_statistics'), - url(r'^user/statistics/(?P[0-9]+)/$', views.fatlink_personal_statistics_view, + re_path(r'^user/statistics/(?P[0-9]+)/$', views.fatlink_personal_statistics_view, name='personal_statistics_year'), - url(r'^user/statistics/(?P[0-9]+)/(?P[0-9]+)/$', + re_path(r'^user/statistics/(?P[0-9]+)/(?P[0-9]+)/$', views.fatlink_monthly_personal_statistics_view, name='personal_statistics_month'), - url(r'^user/(?P[0-9]+)/statistics/(?P[0-9]+)/(?P[0-9]+)/$', + re_path(r'^user/(?P[0-9]+)/statistics/(?P[0-9]+)/(?P[0-9]+)/$', views.fatlink_monthly_personal_statistics_view, name='user_statistics_month'), - url(r'^create/$', views.create_fatlink_view, name='create'), - url(r'^modify/(?P[a-zA-Z0-9_-]+)/$', views.modify_fatlink_view, name='modify'), - url(r'^link/(?P[a-zA-Z0-9]+)/$', views.click_fatlink_view, name='click'), + re_path(r'^create/$', views.create_fatlink_view, name='create'), + re_path(r'^modify/(?P[a-zA-Z0-9_-]+)/$', views.modify_fatlink_view, name='modify'), + re_path(r'^link/(?P[a-zA-Z0-9]+)/$', views.click_fatlink_view, name='click'), ] diff --git a/allianceauth/urls.py b/allianceauth/urls.py index 6edc43ac..6e50722b 100755 --- a/allianceauth/urls.py +++ b/allianceauth/urls.py @@ -1,6 +1,7 @@ +from django.urls import re_path import esi.urls -from django.conf.urls import include, url +from django.conf.urls import include from django.contrib import admin from django.views.generic.base import TemplateView @@ -21,35 +22,35 @@ admin.site.site_header = NAME # Functional/Untranslated URL's urlpatterns = [ # Locale - url(r'^i18n/', include('django.conf.urls.i18n')), + re_path(r'^i18n/', include('django.conf.urls.i18n')), # Authentication - url(r'', include(allianceauth.authentication.urls)), - url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'), - url(r'^account/', include(hmac_urls)), + re_path(r'', include(allianceauth.authentication.urls)), + re_path(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'), + re_path(r'^account/', include(hmac_urls)), # Admin urls - url(r'^admin/', admin.site.urls), + re_path(r'^admin/', admin.site.urls), # SSO - url(r'^sso/', include((esi.urls, 'esi'), namespace='esi')), - url(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'), + re_path(r'^sso/', include((esi.urls, 'esi'), namespace='esi')), + re_path(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'), # Notifications - url(r'', include(allianceauth.notifications.urls)), + re_path(r'', include(allianceauth.notifications.urls)), # Groups - url(r'', include(allianceauth.groupmanagement.urls)), + re_path(r'', include(allianceauth.groupmanagement.urls)), # Services - url(r'', decorate_url_patterns(allianceauth.services.urls.urlpatterns, main_character_required)), + re_path(r'', decorate_url_patterns(allianceauth.services.urls.urlpatterns, main_character_required)), # Night mode - url(r'^night/', views.NightModeRedirectView.as_view(), name='nightmode') + re_path(r'^night/', views.NightModeRedirectView.as_view(), name='nightmode') ] # Append app urls app_urls = get_hooks('url_hook') for app in app_urls: - urlpatterns += [url(r'', decorate_url_patterns([app().include_pattern], main_character_required))] + urlpatterns += [re_path(r'', decorate_url_patterns([app().include_pattern], main_character_required))]