From 909bd0ba1523a13b75bafd803626094b12267a26 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Fri, 24 Dec 2021 17:42:53 +1000 Subject: [PATCH 01/14] Fix deprecations removed in dj4 --- allianceauth/authentication/forms.py | 2 +- allianceauth/authentication/models.py | 2 +- allianceauth/corputils/auth_hooks.py | 2 +- allianceauth/corputils/views.py | 2 +- allianceauth/fleetactivitytracking/auth_hooks.py | 2 +- allianceauth/fleetactivitytracking/forms.py | 2 +- allianceauth/fleetactivitytracking/views.py | 2 +- allianceauth/groupmanagement/auth_hooks.py | 2 +- allianceauth/groupmanagement/views.py | 2 +- allianceauth/hrapplications/auth_hooks.py | 2 +- allianceauth/hrapplications/forms.py | 2 +- allianceauth/optimer/auth_hooks.py | 2 +- allianceauth/optimer/form.py | 2 +- allianceauth/optimer/views.py | 2 +- allianceauth/services/forms.py | 2 +- allianceauth/services/hooks.py | 6 +++--- allianceauth/services/modules/openfire/forms.py | 2 +- allianceauth/services/modules/teamspeak3/forms.py | 2 +- allianceauth/srp/auth_hooks.py | 2 +- allianceauth/srp/form.py | 2 +- allianceauth/timerboard/form.py | 2 +- allianceauth/timerboard/views.py | 2 +- 22 files changed, 24 insertions(+), 24 deletions(-) diff --git a/allianceauth/authentication/forms.py b/allianceauth/authentication/forms.py index ea0379ca..d24ddabd 100644 --- a/allianceauth/authentication/forms.py +++ b/allianceauth/authentication/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.authentication.models import User class RegistrationForm(forms.Form): email = forms.EmailField(label=_('Email'), max_length=254, required=True) diff --git a/allianceauth/authentication/models.py b/allianceauth/authentication/models.py index 9dc2df64..dd4b674f 100755 --- a/allianceauth/authentication/models.py +++ b/allianceauth/authentication/models.py @@ -2,7 +2,7 @@ import logging from django.contrib.auth.models import User, Permission from django.db import models, transaction -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo, EveFactionInfo from allianceauth.notifications import notify diff --git a/allianceauth/corputils/auth_hooks.py b/allianceauth/corputils/auth_hooks.py index e8afc8b6..d90d7f3c 100644 --- a/allianceauth/corputils/auth_hooks.py +++ b/allianceauth/corputils/auth_hooks.py @@ -1,5 +1,5 @@ from allianceauth.services.hooks import MenuItemHook, UrlHook -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from allianceauth.corputils import urls diff --git a/allianceauth/corputils/views.py b/allianceauth/corputils/views.py index fd818896..98367aef 100644 --- a/allianceauth/corputils/views.py +++ b/allianceauth/corputils/views.py @@ -6,7 +6,7 @@ from django.contrib.auth.decorators import login_required, permission_required, from django.core.exceptions import PermissionDenied, ObjectDoesNotExist from django.db import IntegrityError from django.shortcuts import render, redirect, get_object_or_404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from esi.decorators import token_required from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo diff --git a/allianceauth/fleetactivitytracking/auth_hooks.py b/allianceauth/fleetactivitytracking/auth_hooks.py index b54b63cd..8d71fc13 100644 --- a/allianceauth/fleetactivitytracking/auth_hooks.py +++ b/allianceauth/fleetactivitytracking/auth_hooks.py @@ -1,5 +1,5 @@ from . import urls -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from allianceauth.services.hooks import MenuItemHook, UrlHook diff --git a/allianceauth/fleetactivitytracking/forms.py b/allianceauth/fleetactivitytracking/forms.py index 7ef820c2..0bbf560c 100644 --- a/allianceauth/fleetactivitytracking/forms.py +++ b/allianceauth/fleetactivitytracking/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class FatlinkForm(forms.Form): diff --git a/allianceauth/fleetactivitytracking/views.py b/allianceauth/fleetactivitytracking/views.py index 246842e8..f95451c3 100644 --- a/allianceauth/fleetactivitytracking/views.py +++ b/allianceauth/fleetactivitytracking/views.py @@ -10,7 +10,7 @@ from django.contrib.auth.models import User from django.core.exceptions import ValidationError, ObjectDoesNotExist from django.shortcuts import render, redirect, get_object_or_404, Http404 from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from esi.decorators import token_required from allianceauth.eveonline.providers import provider from .forms import FatlinkForm diff --git a/allianceauth/groupmanagement/auth_hooks.py b/allianceauth/groupmanagement/auth_hooks.py index e077110b..45a90e25 100644 --- a/allianceauth/groupmanagement/auth_hooks.py +++ b/allianceauth/groupmanagement/auth_hooks.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.services.hooks import MenuItemHook, UrlHook from allianceauth import hooks diff --git a/allianceauth/groupmanagement/views.py b/allianceauth/groupmanagement/views.py index e8d68157..d47de33c 100755 --- a/allianceauth/groupmanagement/views.py +++ b/allianceauth/groupmanagement/views.py @@ -9,7 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist, PermissionDenied from django.db.models import Count from django.http import Http404 from django.shortcuts import render, redirect, get_object_or_404 -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.notifications import notify diff --git a/allianceauth/hrapplications/auth_hooks.py b/allianceauth/hrapplications/auth_hooks.py index e1a71f02..9f32f8fc 100644 --- a/allianceauth/hrapplications/auth_hooks.py +++ b/allianceauth/hrapplications/auth_hooks.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from allianceauth.services.hooks import MenuItemHook, UrlHook diff --git a/allianceauth/hrapplications/forms.py b/allianceauth/hrapplications/forms.py index 73ffd5c4..9a6d96f4 100755 --- a/allianceauth/hrapplications/forms.py +++ b/allianceauth/hrapplications/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class HRApplicationCommentForm(forms.Form): diff --git a/allianceauth/optimer/auth_hooks.py b/allianceauth/optimer/auth_hooks.py index 23231e75..0570db0f 100644 --- a/allianceauth/optimer/auth_hooks.py +++ b/allianceauth/optimer/auth_hooks.py @@ -1,5 +1,5 @@ from allianceauth.services.hooks import MenuItemHook, UrlHook -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from . import urls diff --git a/allianceauth/optimer/form.py b/allianceauth/optimer/form.py index 8fb97c91..3a870a08 100644 --- a/allianceauth/optimer/form.py +++ b/allianceauth/optimer/form.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth.optimer.form_widgets import DataListWidget diff --git a/allianceauth/optimer/views.py b/allianceauth/optimer/views.py index ae492d03..b16549f8 100644 --- a/allianceauth/optimer/views.py +++ b/allianceauth/optimer/views.py @@ -6,7 +6,7 @@ from django.contrib.auth.decorators import permission_required from django.shortcuts import get_object_or_404 from django.shortcuts import render, redirect from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .form import OpForm from .models import OpTimer, OpTimerType diff --git a/allianceauth/services/forms.py b/allianceauth/services/forms.py index 1eda557e..0dc59111 100644 --- a/allianceauth/services/forms.py +++ b/allianceauth/services/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class FleetFormatterForm(forms.Form): diff --git a/allianceauth/services/hooks.py b/allianceauth/services/hooks.py index b91aca26..59595a84 100644 --- a/allianceauth/services/hooks.py +++ b/allianceauth/services/hooks.py @@ -1,4 +1,5 @@ -from django.conf.urls import include, url +from django.conf.urls import include +from django.urls import re_path from django.core.exceptions import ObjectDoesNotExist from django.template.loader import render_to_string from django.utils.functional import cached_property @@ -9,7 +10,6 @@ from allianceauth.hooks import get_hooks from .models import NameFormatConfig - def get_extension_logger(name): """ Takes the name of a plugin/extension and generates a child logger of the extensions logger @@ -157,7 +157,7 @@ class MenuItemHook: class UrlHook: def __init__(self, urls, namespace, base_url): - self.include_pattern = url(base_url, include(urls, namespace=namespace)) + self.include_pattern = re_path(base_url, include(urls, namespace=namespace)) class NameFormatter: diff --git a/allianceauth/services/modules/openfire/forms.py b/allianceauth/services/modules/openfire/forms.py index 9fbe4cd6..8497a024 100644 --- a/allianceauth/services/modules/openfire/forms.py +++ b/allianceauth/services/modules/openfire/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class JabberBroadcastForm(forms.Form): diff --git a/allianceauth/services/modules/teamspeak3/forms.py b/allianceauth/services/modules/teamspeak3/forms.py index 8e41ca59..1ef735ae 100644 --- a/allianceauth/services/modules/teamspeak3/forms.py +++ b/allianceauth/services/modules/teamspeak3/forms.py @@ -1,5 +1,5 @@ from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .manager import Teamspeak3Manager diff --git a/allianceauth/srp/auth_hooks.py b/allianceauth/srp/auth_hooks.py index c59b3f18..f6a920c8 100644 --- a/allianceauth/srp/auth_hooks.py +++ b/allianceauth/srp/auth_hooks.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from allianceauth import hooks from allianceauth.services.hooks import MenuItemHook, UrlHook diff --git a/allianceauth/srp/form.py b/allianceauth/srp/form.py index a7e80663..e13ed922 100755 --- a/allianceauth/srp/form.py +++ b/allianceauth/srp/form.py @@ -1,7 +1,7 @@ import re from django import forms -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ class SrpFleetMainForm(forms.Form): diff --git a/allianceauth/timerboard/form.py b/allianceauth/timerboard/form.py index 3a42179b..121d4ff3 100755 --- a/allianceauth/timerboard/form.py +++ b/allianceauth/timerboard/form.py @@ -3,7 +3,7 @@ import datetime from django import forms from django.utils import timezone from django.core.validators import MaxValueValidator, MinValueValidator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .models import Timer, TimerType diff --git a/allianceauth/timerboard/views.py b/allianceauth/timerboard/views.py index ebc4715b..9da84b1e 100755 --- a/allianceauth/timerboard/views.py +++ b/allianceauth/timerboard/views.py @@ -9,7 +9,7 @@ from django.urls import reverse_lazy from django.views.generic import CreateView, UpdateView, DeleteView from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from .form import TimerForm from .models import Timer From 6b68a739ef1f070e7d146a5c1f99141cdb6fc508 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Fri, 24 Dec 2021 17:43:15 +1000 Subject: [PATCH 02/14] Initial spam of version bumps --- setup.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 7665e992..209371b2 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() install_requires = [ - 'mysqlclient', + 'mysqlclient>=2.1.0', 'dnspython', 'passlib', 'requests>=2.9.1,<3.0.0', @@ -18,16 +18,16 @@ install_requires = [ 'packaging>=21.0,<22', 'beautifulsoup4', - 'redis>=3.3.1,<4.0.0', - 'celery>=4.3.0,<6.0.0,!=4.4.4', # 4.4.4 is missing a dependency - 'celery_once>=2.0.1', + 'redis>=4.0.0,<5.0.0', + 'celery>=5.2.0,<6.0.0', + 'celery_once>=3.0.1', - 'django>=3.2.9,<4.0.0', + 'django>=4.0.0,<5.0.0', 'django-bootstrap-form', - 'django-registration>=3.1', + 'django-registration>=3.2', 'django-sortedm2m', - 'django-redis-cache>=3.0.0', - 'django-celery-beat>=2.0.0', + 'django-redis>=5.2.0', + 'django-celery-beat>=2.2.1', 'openfire-restapi', 'sleekxmpp', @@ -70,7 +70,7 @@ setup( classifiers=[ 'Environment :: Web Environment', 'Framework :: Django', - 'Framework :: Django :: 3.2', + 'Framework :: Django :: 4', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 'Operating System :: POSIX :: Linux', From 255966ed3bc8da56fdb69cfd2037780a4c8fb862 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 29 Dec 2021 16:32:42 +1000 Subject: [PATCH 03/14] Secret Detection was split from SAST --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 08a8d32c..090ce093 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,7 @@ stages: include: - template: Dependency-Scanning.gitlab-ci.yml - template: Security/SAST.gitlab-ci.yml +- template: Security/Secret-Detection.gitlab-ci.yml before_script: - apt-get update && apt-get install redis-server -y From f18dd1029bb9967e56c25990b1c3e456d03bdde6 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Mon, 31 Jan 2022 20:58:09 +1000 Subject: [PATCH 04/14] Version Bump v2.10.0 --- allianceauth/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/__init__.py b/allianceauth/__init__.py index 7146f256..ee748419 100644 --- a/allianceauth/__init__.py +++ b/allianceauth/__init__.py @@ -1,7 +1,7 @@ # This will make sure the app is always imported when # Django starts so that shared_task will use this app. -__version__ = '2.9.4' +__version__ = '2.10.0' __title__ = 'Alliance Auth' __url__ = 'https://gitlab.com/allianceauth/allianceauth' NAME = f'{__title__} v{__version__}' From cc94ba6b5e242b191adf1adc92a17d2d38f8e0cc Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 2 Feb 2022 14:16:33 +1000 Subject: [PATCH 05/14] ensure latest django patch --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 209371b2..f7aa3a96 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ install_requires = [ 'celery>=5.2.0,<6.0.0', 'celery_once>=3.0.1', - 'django>=4.0.0,<5.0.0', + 'django>=4.0.2,<5.0.0', 'django-bootstrap-form', 'django-registration>=3.2', 'django-sortedm2m', From ffff904ab1257663e11ca1688473c15a30c31875 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 2 Feb 2022 15:18:20 +1000 Subject: [PATCH 06/14] Pull specific commit from git temporarily --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2f22e19d..335ba2bd 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ install_requires = [ 'django-registration>=3.2', 'django-sortedm2m', 'django-redis>=5.2.0<6.0.0', - 'django-celery-beat>=2.2.1', + 'django-celery-beat @ git+https://github.com/celery/django-celery-beat.git', 'openfire-restapi', 'sleekxmpp', From 234451a7d47bf200142680144e4ab6676a307f1d Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 2 Feb 2022 21:37:01 +1000 Subject: [PATCH 07/14] temporarily use django-esi MR --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 335ba2bd..c0b3f47a 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ install_requires = [ 'sleekxmpp', 'pydiscourse', - 'django-esi>=3.0.0,<4.0.0' + 'django-esi @ git+https://gitlab.com/soratidus999/django-esi.git@py310', ] testing_extras = [ From c7b99044bcec8cdf6de284a08a5a678d1cdd16b4 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 2 Feb 2022 21:39:37 +1000 Subject: [PATCH 08/14] 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))] From fd442a57356e2b1aaf9d6de3b8d96cf9a634f123 Mon Sep 17 00:00:00 2001 From: Ariel Rin Date: Wed, 2 Feb 2022 21:56:01 +1000 Subject: [PATCH 09/14] django.conf.urls.url is deprecated --- allianceauth/groupmanagement/urls.py | 27 ++++++++-------- allianceauth/hrapplications/urls.py | 24 +++++++------- allianceauth/notifications/urls.py | 14 ++++---- allianceauth/optimer/urls.py | 10 +++--- allianceauth/permissions_tool/urls.py | 6 ++-- .../project_template/project_name/urls.py | 5 +-- allianceauth/services/modules/discord/urls.py | 15 +++++---- .../services/modules/discourse/urls.py | 4 +-- allianceauth/services/modules/example/urls.py | 5 +-- allianceauth/services/modules/ips4/urls.py | 13 ++++---- allianceauth/services/modules/mumble/urls.py | 13 ++++---- .../services/modules/openfire/urls.py | 15 +++++---- allianceauth/services/modules/phpbb3/urls.py | 13 ++++---- allianceauth/services/modules/smf/urls.py | 13 ++++---- .../services/modules/teamspeak3/urls.py | 15 +++++---- allianceauth/services/modules/xenforo/urls.py | 13 ++++---- allianceauth/services/urls.py | 9 +++--- allianceauth/srp/urls.py | 32 +++++++++---------- allianceauth/timerboard/urls.py | 10 +++--- docs/customizing/index.md | 10 +++--- docs/development/custom/url-hooks.md | 2 +- tests/urls.py | 9 +++--- 22 files changed, 143 insertions(+), 134 deletions(-) diff --git a/allianceauth/groupmanagement/urls.py b/allianceauth/groupmanagement/urls.py index 435761ca..a1c5a01d 100644 --- a/allianceauth/groupmanagement/urls.py +++ b/allianceauth/groupmanagement/urls.py @@ -1,50 +1,49 @@ +from django.urls import re_path from . import views -from django.conf.urls import url - app_name = "groupmanagement" urlpatterns = [ # groups - url(r"^groups/$", views.groups_view, name="groups"), - url(r"^group/request/join/(\w+)/$", views.group_request_add, name="request_add"), - url( + re_path(r"^groups/$", views.groups_view, name="groups"), + re_path(r"^group/request/join/(\w+)/$", views.group_request_add, name="request_add"), + re_path( r"^group/request/leave/(\w+)/$", views.group_request_leave, name="request_leave" ), # group management - url(r"^groupmanagement/requests/$", views.group_management, name="management"), - url(r"^groupmanagement/membership/$", views.group_membership, name="membership"), - url( + re_path(r"^groupmanagement/requests/$", views.group_management, name="management"), + re_path(r"^groupmanagement/membership/$", views.group_membership, name="membership"), + re_path( r"^groupmanagement/membership/(\w+)/$", views.group_membership_list, name="membership", ), - url( + re_path( r"^groupmanagement/membership/(\w+)/audit-log/$", views.group_membership_audit, name="audit_log", ), - url( + re_path( r"^groupmanagement/membership/(\w+)/remove/(\w+)/$", views.group_membership_remove, name="membership_remove", ), - url( + re_path( r"^groupmanagement/request/join/accept/(\w+)/$", views.group_accept_request, name="accept_request", ), - url( + re_path( r"^groupmanagement/request/join/reject/(\w+)/$", views.group_reject_request, name="reject_request", ), - url( + re_path( r"^groupmanagement/request/leave/accept/(\w+)/$", views.group_leave_accept_request, name="leave_accept_request", ), - url( + re_path( r"^groupmanagement/request/leave/reject/(\w+)/$", views.group_leave_reject_request, name="leave_reject_request", diff --git a/allianceauth/hrapplications/urls.py b/allianceauth/hrapplications/urls.py index efbcfe4a..e6dc2783 100644 --- a/allianceauth/hrapplications/urls.py +++ b/allianceauth/hrapplications/urls.py @@ -1,31 +1,31 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'hrapplications' urlpatterns = [ - url(r'^$', views.hr_application_management_view, + re_path(r'^$', views.hr_application_management_view, name="index"), - url(r'^create/$', views.hr_application_create_view, + re_path(r'^create/$', views.hr_application_create_view, name="create_view"), - url(r'^create/(\d+)', views.hr_application_create_view, + re_path(r'^create/(\d+)', views.hr_application_create_view, name="create_view"), - url(r'^remove/(\w+)', views.hr_application_remove, + re_path(r'^remove/(\w+)', views.hr_application_remove, name="remove"), - url(r'^view/(\w+)', views.hr_application_view, + re_path(r'^view/(\w+)', views.hr_application_view, name="view"), - url(r'^personal/view/(\w+)', views.hr_application_personal_view, + re_path(r'^personal/view/(\w+)', views.hr_application_personal_view, name="personal_view"), - url(r'^personal/removal/(\w+)', + re_path(r'^personal/removal/(\w+)', views.hr_application_personal_removal, name="personal_removal"), - url(r'^approve/(\w+)', views.hr_application_approve, + re_path(r'^approve/(\w+)', views.hr_application_approve, name="approve"), - url(r'^reject/(\w+)', views.hr_application_reject, + re_path(r'^reject/(\w+)', views.hr_application_reject, name="reject"), - url(r'^search/', views.hr_application_search, + re_path(r'^search/', views.hr_application_search, name="search"), - url(r'^mark_in_progress/(\w+)', views.hr_application_mark_in_progress, + re_path(r'^mark_in_progress/(\w+)', views.hr_application_mark_in_progress, name="mark_in_progress"), ] diff --git a/allianceauth/notifications/urls.py b/allianceauth/notifications/urls.py index eeeecfc9..b9e849ad 100644 --- a/allianceauth/notifications/urls.py +++ b/allianceauth/notifications/urls.py @@ -1,15 +1,15 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'notifications' # Notifications urlpatterns = [ - url(r'^remove_notifications/(\w+)/$', views.remove_notification, name='remove'), - url(r'^notifications/mark_all_read/$', views.mark_all_read, name='mark_all_read'), - url(r'^notifications/delete_all_read/$', views.delete_all_read, name='delete_all_read'), - url(r'^notifications/$', views.notification_list, name='list'), - url(r'^notifications/(\w+)/$', views.notification_view, name='view'), - url( + re_path(r'^remove_notifications/(\w+)/$', views.remove_notification, name='remove'), + re_path(r'^notifications/mark_all_read/$', views.mark_all_read, name='mark_all_read'), + re_path(r'^notifications/delete_all_read/$', views.delete_all_read, name='delete_all_read'), + re_path(r'^notifications/$', views.notification_list, name='list'), + re_path(r'^notifications/(\w+)/$', views.notification_view, name='view'), + re_path( r'^user_notifications_count/(?P\d+)/$', views.user_notifications_count, name='user_notifications_count' diff --git a/allianceauth/optimer/urls.py b/allianceauth/optimer/urls.py index bbdb28ff..a90a9f5f 100644 --- a/allianceauth/optimer/urls.py +++ b/allianceauth/optimer/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'optimer' urlpatterns = [ - url(r'^$', views.optimer_view, name='view'), - url(r'^add$', views.add_optimer_view, name='add'), - url(r'^(\w+)/remove$', views.remove_optimer, name='remove'), - url(r'^(\w+)/edit$', views.edit_optimer, name='edit'), + re_path(r'^$', views.optimer_view, name='view'), + re_path(r'^add$', views.add_optimer_view, name='add'), + re_path(r'^(\w+)/remove$', views.remove_optimer, name='remove'), + re_path(r'^(\w+)/edit$', views.edit_optimer, name='edit'), ] diff --git a/allianceauth/permissions_tool/urls.py b/allianceauth/permissions_tool/urls.py index b0e1b6a9..bf4b1c04 100644 --- a/allianceauth/permissions_tool/urls.py +++ b/allianceauth/permissions_tool/urls.py @@ -1,11 +1,11 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'permissions_tool' urlpatterns = [ - url(r'^overview/$', views.permissions_overview, name='overview'), - url(r'^audit/(?P[\w\-_]+)/(?P[\w\-_]+)/(?P[\w\-_]+)/$', views.permissions_audit, + re_path(r'^overview/$', views.permissions_overview, name='overview'), + re_path(r'^audit/(?P[\w\-_]+)/(?P[\w\-_]+)/(?P[\w\-_]+)/$', views.permissions_audit, name='audit'), ] diff --git a/allianceauth/project_template/project_name/urls.py b/allianceauth/project_template/project_name/urls.py index e9afaaf0..803ef102 100644 --- a/allianceauth/project_template/project_name/urls.py +++ b/allianceauth/project_template/project_name/urls.py @@ -1,8 +1,9 @@ -from django.conf.urls import include, url +from django.conf.urls import include from allianceauth import urls +from django.urls import re_path urlpatterns = [ - url(r'', include(urls)), + re_path(r'', include(urls)), ] handler500 = 'allianceauth.views.Generic500Redirect' diff --git a/allianceauth/services/modules/discord/urls.py b/allianceauth/services/modules/discord/urls.py index 30f48937..3e9af992 100644 --- a/allianceauth/services/modules/discord/urls.py +++ b/allianceauth/services/modules/discord/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,13 +7,13 @@ app_name = 'discord' module_urls = [ # Discord Service Control - url(r'^activate/$', views.activate_discord, name='activate'), - url(r'^deactivate/$', views.deactivate_discord, name='deactivate'), - url(r'^reset/$', views.reset_discord, name='reset'), - url(r'^callback/$', views.discord_callback, name='callback'), - url(r'^add_bot/$', views.discord_add_bot, name='add_bot'), + re_path(r'^activate/$', views.activate_discord, name='activate'), + re_path(r'^deactivate/$', views.deactivate_discord, name='deactivate'), + re_path(r'^reset/$', views.reset_discord, name='reset'), + re_path(r'^callback/$', views.discord_callback, name='callback'), + re_path(r'^add_bot/$', views.discord_add_bot, name='add_bot'), ] urlpatterns = [ - url(r'^discord/', include((module_urls, app_name), namespace=app_name)) + re_path(r'^discord/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/discourse/urls.py b/allianceauth/services/modules/discourse/urls.py index 207bedc4..e0cd1e7b 100644 --- a/allianceauth/services/modules/discourse/urls.py +++ b/allianceauth/services/modules/discourse/urls.py @@ -1,8 +1,8 @@ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ # Discourse Service Control - url(r'^discourse/sso$', views.discourse_sso, name='auth_discourse_sso'), + re_path(r'^discourse/sso$', views.discourse_sso, name='auth_discourse_sso'), ] diff --git a/allianceauth/services/modules/example/urls.py b/allianceauth/services/modules/example/urls.py index f72d9abd..fb1edaad 100644 --- a/allianceauth/services/modules/example/urls.py +++ b/allianceauth/services/modules/example/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path app_name = 'example' @@ -7,5 +8,5 @@ module_urls = [ ] urlpatterns = [ - url(r'^example/', include((module_urls, app_name), namespace=app_name)), + re_path(r'^example/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/ips4/urls.py b/allianceauth/services/modules/ips4/urls.py index a13a98e6..ceaf9572 100644 --- a/allianceauth/services/modules/ips4/urls.py +++ b/allianceauth/services/modules/ips4/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,12 +7,12 @@ app_name = 'ips4' module_urls = [ # IPS4 Service Control - url(r'^activate/$', views.activate_ips4, name='activate'), - url(r'^deactivate/$', views.deactivate_ips4, name='deactivate'), - url(r'^reset_password/$', views.reset_ips4_password, name='reset_password'), - url(r'^set_password/$', views.set_ips4_password, name='set_password'), + re_path(r'^activate/$', views.activate_ips4, name='activate'), + re_path(r'^deactivate/$', views.deactivate_ips4, name='deactivate'), + re_path(r'^reset_password/$', views.reset_ips4_password, name='reset_password'), + re_path(r'^set_password/$', views.set_ips4_password, name='set_password'), ] urlpatterns = [ - url(r'^ips4/', include((module_urls, app_name), namespace=app_name)) + re_path(r'^ips4/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/mumble/urls.py b/allianceauth/services/modules/mumble/urls.py index 03787422..586342e3 100644 --- a/allianceauth/services/modules/mumble/urls.py +++ b/allianceauth/services/modules/mumble/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,12 +7,12 @@ app_name = 'mumble' module_urls = [ # Mumble service control - url(r'^activate/$', views.CreateAccountMumbleView.as_view(), name='activate'), - url(r'^deactivate/$', views.DeleteMumbleView.as_view(), name='deactivate'), - url(r'^reset_password/$', views.ResetPasswordMumbleView.as_view(), name='reset_password'), - url(r'^set_password/$', views.SetPasswordMumbleView.as_view(), name='set_password'), + re_path(r'^activate/$', views.CreateAccountMumbleView.as_view(), name='activate'), + re_path(r'^deactivate/$', views.DeleteMumbleView.as_view(), name='deactivate'), + re_path(r'^reset_password/$', views.ResetPasswordMumbleView.as_view(), name='reset_password'), + re_path(r'^set_password/$', views.SetPasswordMumbleView.as_view(), name='set_password'), ] urlpatterns = [ - url(r'^mumble/', include((module_urls, app_name), namespace=app_name)) + re_path(r'^mumble/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/openfire/urls.py b/allianceauth/services/modules/openfire/urls.py index 230d9fb4..e24319f2 100644 --- a/allianceauth/services/modules/openfire/urls.py +++ b/allianceauth/services/modules/openfire/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,13 +7,13 @@ app_name = 'openfire' module_urls = [ # Jabber Service Control - url(r'^activate/$', views.activate_jabber, name='activate'), - url(r'^deactivate/$', views.deactivate_jabber, name='deactivate'), - url(r'^reset_password/$', views.reset_jabber_password, name='reset_password'), - url(r'^set_password/$', views.set_jabber_password, name='set_password'), - url(r'^broadcast/$', views.jabber_broadcast_view, name='broadcast'), + re_path(r'^activate/$', views.activate_jabber, name='activate'), + re_path(r'^deactivate/$', views.deactivate_jabber, name='deactivate'), + re_path(r'^reset_password/$', views.reset_jabber_password, name='reset_password'), + re_path(r'^set_password/$', views.set_jabber_password, name='set_password'), + re_path(r'^broadcast/$', views.jabber_broadcast_view, name='broadcast'), ] urlpatterns = [ - url(r'^openfire/', include((module_urls, app_name), namespace=app_name)), + re_path(r'^openfire/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/phpbb3/urls.py b/allianceauth/services/modules/phpbb3/urls.py index 26611469..a9de3356 100644 --- a/allianceauth/services/modules/phpbb3/urls.py +++ b/allianceauth/services/modules/phpbb3/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,12 +7,12 @@ app_name = 'phpbb3' module_urls = [ # Forum Service Control - url(r'^activate/$', views.activate_forum, name='activate'), - url(r'^deactivate/$', views.deactivate_forum, name='deactivate'), - url(r'^reset_password/$', views.reset_forum_password, name='reset_password'), - url(r'^set_password/$', views.set_forum_password, name='set_password'), + re_path(r'^activate/$', views.activate_forum, name='activate'), + re_path(r'^deactivate/$', views.deactivate_forum, name='deactivate'), + re_path(r'^reset_password/$', views.reset_forum_password, name='reset_password'), + re_path(r'^set_password/$', views.set_forum_password, name='set_password'), ] urlpatterns = [ - url(r'^phpbb3/', include((module_urls, app_name), namespace=app_name)) + re_path(r'^phpbb3/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/smf/urls.py b/allianceauth/services/modules/smf/urls.py index 59e396bf..e5a079b4 100644 --- a/allianceauth/services/modules/smf/urls.py +++ b/allianceauth/services/modules/smf/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,12 +7,12 @@ app_name = 'smf' module_urls = [ # SMF Service Control - url(r'^activate/$', views.activate_smf, name='activate'), - url(r'^deactivate/$', views.deactivate_smf, name='deactivate'), - url(r'^reset_password/$', views.reset_smf_password, name='reset_password'), - url(r'^set_password/$', views.set_smf_password, name='set_password'), + re_path(r'^activate/$', views.activate_smf, name='activate'), + re_path(r'^deactivate/$', views.deactivate_smf, name='deactivate'), + re_path(r'^reset_password/$', views.reset_smf_password, name='reset_password'), + re_path(r'^set_password/$', views.set_smf_password, name='set_password'), ] urlpatterns = [ - url(r'^smf/', include((module_urls, app_name), namespace=app_name)), + re_path(r'^smf/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/teamspeak3/urls.py b/allianceauth/services/modules/teamspeak3/urls.py index d46bf0c2..420753fa 100644 --- a/allianceauth/services/modules/teamspeak3/urls.py +++ b/allianceauth/services/modules/teamspeak3/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,19 +7,19 @@ app_name = 'teamspeak3' module_urls = [ # Teamspeak3 service control - url(r'^activate/$', views.activate_teamspeak3, name='activate'), - url(r'^deactivate/$', views.deactivate_teamspeak3, name='deactivate'), - url(r'^reset_perm/$', views.reset_teamspeak3_perm, name='reset_perm'), - url( + re_path(r'^activate/$', views.activate_teamspeak3, name='activate'), + re_path(r'^deactivate/$', views.deactivate_teamspeak3, name='deactivate'), + re_path(r'^reset_perm/$', views.reset_teamspeak3_perm, name='reset_perm'), + re_path( r'^admin_update_ts3_groups/$', views.admin_update_ts3_groups, name='admin_update_ts3_groups' ), # Teamspeak Urls - url(r'^verify/$', views.verify_teamspeak3, name='verify'), + re_path(r'^verify/$', views.verify_teamspeak3, name='verify'), ] urlpatterns = [ - url(r'^teamspeak3/', include((module_urls, app_name), namespace=app_name)), + re_path(r'^teamspeak3/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/xenforo/urls.py b/allianceauth/services/modules/xenforo/urls.py index 123e7bfe..bcb6a2a2 100644 --- a/allianceauth/services/modules/xenforo/urls.py +++ b/allianceauth/services/modules/xenforo/urls.py @@ -1,4 +1,5 @@ -from django.conf.urls import url, include +from django.conf.urls import include +from django.urls import re_path from . import views @@ -6,12 +7,12 @@ app_name = 'xenforo' module_urls = [ # XenForo service control - url(r'^activate/$', views.activate_xenforo_forum, name='activate'), - url(r'^deactivate/$', views.deactivate_xenforo_forum, name='deactivate'), - url(r'^reset_password/$', views.reset_xenforo_password, name='reset_password'), - url(r'^set_password/$', views.set_xenforo_password, name='set_password'), + re_path(r'^activate/$', views.activate_xenforo_forum, name='activate'), + re_path(r'^deactivate/$', views.deactivate_xenforo_forum, name='deactivate'), + re_path(r'^reset_password/$', views.reset_xenforo_password, name='reset_password'), + re_path(r'^set_password/$', views.set_xenforo_password, name='set_password'), ] urlpatterns = [ - url(r'^xenforo/', include((module_urls, app_name), namespace=app_name)), + re_path(r'^xenforo/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/urls.py b/allianceauth/services/urls.py index 0503d292..c7a0fb41 100644 --- a/allianceauth/services/urls.py +++ b/allianceauth/services/urls.py @@ -1,14 +1,15 @@ -from django.conf.urls import include, url +from django.conf.urls import include from allianceauth.hooks import get_hooks +from django.urls import re_path from . import views urlpatterns = [ # Services - url(r'^services/', include(([ - url(r'^$', views.services_view, name='services'), + re_path(r'^services/', include(([ + re_path(r'^$', views.services_view, name='services'), # Tools - url(r'^tool/fleet_formatter_tool/$', views.fleet_formatter_view, name='fleet_format_tool'), + re_path(r'^tool/fleet_formatter_tool/$', views.fleet_formatter_view, name='fleet_format_tool'), ], 'services'), namespace='services')), ] diff --git a/allianceauth/srp/urls.py b/allianceauth/srp/urls.py index d357a7ce..45f8fab8 100644 --- a/allianceauth/srp/urls.py +++ b/allianceauth/srp/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import url +from django.urls import re_path from . import views @@ -6,27 +6,27 @@ app_name = 'srp' urlpatterns = [ # SRP URLS - url(r'^$', views.srp_management, name='management'), - url(r'^all/$', views.srp_management, {'all': True}, name='all'), - url(r'^(\w+)/view$', views.srp_fleet_view, name='fleet'), - url(r'^add/$', views.srp_fleet_add_view, name='add'), - url(r'^(\w+)/edit$', views.srp_fleet_edit_view, name='edit'), - url(r'^(\w+)/request', views.srp_request_view, name='request'), + re_path(r'^$', views.srp_management, name='management'), + re_path(r'^all/$', views.srp_management, {'all': True}, name='all'), + re_path(r'^(\w+)/view$', views.srp_fleet_view, name='fleet'), + re_path(r'^add/$', views.srp_fleet_add_view, name='add'), + re_path(r'^(\w+)/edit$', views.srp_fleet_edit_view, name='edit'), + re_path(r'^(\w+)/request', views.srp_request_view, name='request'), # SRP URLS - url(r'^(\w+)/remove$', views.srp_fleet_remove, name='remove'), - url(r'^(\w+)/disable$', views.srp_fleet_disable, name='disable'), - url(r'^(\w+)/enable$', views.srp_fleet_enable, name='enable'), - url(r'^(\w+)/complete$', views.srp_fleet_mark_completed, + re_path(r'^(\w+)/remove$', views.srp_fleet_remove, name='remove'), + re_path(r'^(\w+)/disable$', views.srp_fleet_disable, name='disable'), + re_path(r'^(\w+)/enable$', views.srp_fleet_enable, name='enable'), + re_path(r'^(\w+)/complete$', views.srp_fleet_mark_completed, name='mark_completed'), - url(r'^(\w+)/incomplete$', views.srp_fleet_mark_uncompleted, + re_path(r'^(\w+)/incomplete$', views.srp_fleet_mark_uncompleted, name='mark_uncompleted'), - url(r'^request/remove/', views.srp_request_remove, + re_path(r'^request/remove/', views.srp_request_remove, name="request_remove"), - url(r'^request/approve/', views.srp_request_approve, + re_path(r'^request/approve/', views.srp_request_approve, name='request_approve'), - url(r'^request/reject/', views.srp_request_reject, + re_path(r'^request/reject/', views.srp_request_reject, name='request_reject'), - url(r'^request/(\w+)/update', views.srp_request_update_amount, + re_path(r'^request/(\w+)/update', views.srp_request_update_amount, name="request_update_amount"), ] diff --git a/allianceauth/timerboard/urls.py b/allianceauth/timerboard/urls.py index d4102494..c9de7a5c 100644 --- a/allianceauth/timerboard/urls.py +++ b/allianceauth/timerboard/urls.py @@ -1,12 +1,12 @@ -from django.conf.urls import url +from django.urls import re_path from . import views app_name = 'timerboard' urlpatterns = [ - url(r'^$', views.TimerView.as_view(), name='view'), - url(r'^add/$', views.AddTimerView.as_view(), name='add'), - url(r'^remove/(?P\w+)$', views.RemoveTimerView.as_view(), name='delete'), - url(r'^edit/(?P\w+)$', views.EditTimerView.as_view(), name='edit'), + re_path(r'^$', views.TimerView.as_view(), name='view'), + re_path(r'^add/$', views.AddTimerView.as_view(), name='add'), + re_path(r'^remove/(?P\w+)$', views.RemoveTimerView.as_view(), name='delete'), + re_path(r'^edit/(?P\w+)$', views.EditTimerView.as_view(), name='edit'), ] diff --git a/docs/customizing/index.md b/docs/customizing/index.md index 99df4759..6105589d 100644 --- a/docs/customizing/index.md +++ b/docs/customizing/index.md @@ -33,7 +33,7 @@ It is possible to add or override URLs with your auth project's URL config file. import allianceauth.urls urlpatterns = [ - url(r'', include(allianceauth.urls)), + re_path(r'', include(allianceauth.urls)), ] ``` @@ -46,8 +46,8 @@ import allianceauth.urls import myauth.views urlpatterns = [ - url(r'', include(allianceauth.urls)), - url(r'myview/$', myauth.views.myview, name='myview'), + re_path(r'', include(allianceauth.urls)), + re_path(r'myview/$', myauth.views.myview, name='myview'), ] ``` @@ -58,7 +58,7 @@ import allianceauth.urls import myauth.views urlpatterns = [ - url(r'account/login/$', myauth.views.login, name='auth_login_user'), - url(r'', include(allianceauth.urls)), + re_path(r'account/login/$', myauth.views.login, name='auth_login_user'), + re_path(r'', include(allianceauth.urls)), ] ``` diff --git a/docs/development/custom/url-hooks.md b/docs/development/custom/url-hooks.md index 95d39da6..d0698351 100644 --- a/docs/development/custom/url-hooks.md +++ b/docs/development/custom/url-hooks.md @@ -38,7 +38,7 @@ The app's `urls.py` would look like so: import plugin.views urlpatterns = [ - url(r^'index$', plugins.views.index, name='index'), + re_path(r^'index$', plugins.views.index, name='index'), ] Subsequently it would implement the UrlHook in a dedicated `auth_hooks.py` file like so: diff --git a/tests/urls.py b/tests/urls.py index 12f563e6..423ce0c0 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,15 +1,14 @@ -from django.conf.urls import url - import allianceauth.urls +from django.urls import re_path from . import views urlpatterns = allianceauth.urls.urlpatterns urlpatterns += [ # Navhelper test urls - url(r'^main-page/$', views.page, name='p1'), - url(r'^main-page/sub-section/$', views.page, name='p1-s1'), - url(r'^second-page/$', views.page, name='p1'), + re_path(r'^main-page/$', views.page, name='p1'), + re_path(r'^main-page/sub-section/$', views.page, name='p1-s1'), + re_path(r'^second-page/$', views.page, name='p1'), ] handler500 = 'allianceauth.views.Generic500Redirect' From 640a21e4db11947748e83863333ed75fe1080166 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 2 Feb 2022 15:09:48 +0100 Subject: [PATCH 10/14] Switch to `path`, use `re_path` only when really needed --- allianceauth/authentication/hmac_urls.py | 11 ++--- allianceauth/authentication/urls.py | 19 ++++----- allianceauth/corputils/urls.py | 14 +++---- allianceauth/fleetactivitytracking/urls.py | 26 ++++++------ allianceauth/groupmanagement/urls.py | 42 +++++++++---------- allianceauth/hrapplications/urls.py | 26 ++++++------ allianceauth/notifications/urls.py | 16 +++---- allianceauth/optimer/urls.py | 12 +++--- allianceauth/permissions_tool/urls.py | 3 +- allianceauth/services/modules/discord/urls.py | 14 +++---- .../services/modules/discourse/urls.py | 4 +- allianceauth/services/modules/example/urls.py | 4 +- allianceauth/services/modules/ips4/urls.py | 12 +++--- allianceauth/services/modules/mumble/urls.py | 12 +++--- .../services/modules/openfire/urls.py | 14 +++---- allianceauth/services/modules/phpbb3/urls.py | 12 +++--- allianceauth/services/modules/smf/urls.py | 12 +++--- .../services/modules/teamspeak3/urls.py | 16 +++---- allianceauth/services/modules/xenforo/urls.py | 12 +++--- allianceauth/services/urls.py | 8 ++-- allianceauth/srp/urls.py | 32 +++++++------- allianceauth/timerboard/urls.py | 10 ++--- allianceauth/urls.py | 26 ++++++------ tests/urls.py | 16 +++---- 24 files changed, 187 insertions(+), 186 deletions(-) diff --git a/allianceauth/authentication/hmac_urls.py b/allianceauth/authentication/hmac_urls.py index 2157bd27..8e7f3128 100644 --- a/allianceauth/authentication/hmac_urls.py +++ b/allianceauth/authentication/hmac_urls.py @@ -2,14 +2,15 @@ from django.conf.urls import include from allianceauth.authentication import views from django.urls import re_path +from django.urls import path urlpatterns = [ - re_path(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'), + 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. 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')), + path('register/', views.RegistrationView.as_view(), name='registration_register'), + path('register/complete/', views.registration_complete, name='registration_complete'), + path('register/closed/', views.registration_closed, name='registration_disallowed'), + path('', include('django.contrib.auth.urls')), ] diff --git a/allianceauth/authentication/urls.py b/allianceauth/authentication/urls.py index 102b95bb..adef3e5f 100644 --- a/allianceauth/authentication/urls.py +++ b/allianceauth/authentication/urls.py @@ -1,5 +1,4 @@ -from django.contrib.auth.decorators import login_required -from django.urls import re_path +from django.urls import path from django.views.generic.base import TemplateView from . import views @@ -7,21 +6,21 @@ from . import views app_name = 'authentication' urlpatterns = [ - re_path(r'^$', views.index, name='index'), - re_path( - r'^account/login/$', + path('', views.index, name='index'), + path( + 'account/login/', TemplateView.as_view(template_name='public/login.html'), name='login' ), - re_path( - r'^account/characters/main/$', + path( + 'account/characters/main/', views.main_character_change, name='change_main_character' ), - re_path( - r'^account/characters/add/$', + path( + 'account/characters/add/', views.add_character, name='add_character' ), - re_path(r'^dashboard/$', views.dashboard, name='dashboard'), + path('dashboard/', views.dashboard, name='dashboard'), ] diff --git a/allianceauth/corputils/urls.py b/allianceauth/corputils/urls.py index 64504ede..5f66c48e 100644 --- a/allianceauth/corputils/urls.py +++ b/allianceauth/corputils/urls.py @@ -1,11 +1,11 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = 'corputils' urlpatterns = [ - 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'), - ] + path('', views.corpstats_view, name='view'), + path('add/', views.corpstats_add, name='add'), + path('/', views.corpstats_view, name='view_corp'), + path('/update/', views.corpstats_update, name='update'), + path('search/', views.corpstats_search, name='search'), +] diff --git a/allianceauth/fleetactivitytracking/urls.py b/allianceauth/fleetactivitytracking/urls.py index 6d270559..41603150 100644 --- a/allianceauth/fleetactivitytracking/urls.py +++ b/allianceauth/fleetactivitytracking/urls.py @@ -1,30 +1,30 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = 'fleetactivitytracking' urlpatterns = [ # FleetActivityTracking (FAT) - 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, + path('', views.fatlink_view, name='view'), + path('statistics/', views.fatlink_statistics_view, name='statistics'), + path('statistics/corp//', views.fatlink_statistics_corp_view, name='statistics_corp'), - re_path(r'^statistics/corp/(?P\w+)/(?P[0-9]+)/(?P[0-9]+)/', + path('statistics/corp////', views.fatlink_statistics_corp_view, name='statistics_corp_month'), - re_path(r'^statistics/(?P[0-9]+)/(?P[0-9]+)/$', views.fatlink_statistics_view, + path('statistics///', views.fatlink_statistics_view, name='statistics_month'), - re_path(r'^user/statistics/$', views.fatlink_personal_statistics_view, + path('user/statistics/', views.fatlink_personal_statistics_view, name='personal_statistics'), - re_path(r'^user/statistics/(?P[0-9]+)/$', views.fatlink_personal_statistics_view, + path('user/statistics//', views.fatlink_personal_statistics_view, name='personal_statistics_year'), - re_path(r'^user/statistics/(?P[0-9]+)/(?P[0-9]+)/$', + path('user/statistics///', views.fatlink_monthly_personal_statistics_view, name='personal_statistics_month'), - re_path(r'^user/(?P[0-9]+)/statistics/(?P[0-9]+)/(?P[0-9]+)/$', + path('user//statistics///', views.fatlink_monthly_personal_statistics_view, name='user_statistics_month'), - 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'), + path('create/', views.create_fatlink_view, name='create'), + path('modify//', views.modify_fatlink_view, name='modify'), + path('link//', views.click_fatlink_view, name='click'), ] diff --git a/allianceauth/groupmanagement/urls.py b/allianceauth/groupmanagement/urls.py index a1c5a01d..568d0ea0 100644 --- a/allianceauth/groupmanagement/urls.py +++ b/allianceauth/groupmanagement/urls.py @@ -1,50 +1,50 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = "groupmanagement" urlpatterns = [ # groups - re_path(r"^groups/$", views.groups_view, name="groups"), - re_path(r"^group/request/join/(\w+)/$", views.group_request_add, name="request_add"), - re_path( - r"^group/request/leave/(\w+)/$", views.group_request_leave, name="request_leave" + path("groups", views.groups_view, name="groups"), + path("group/request/join//", views.group_request_add, name="request_add"), + path( + "group/request/leave//", views.group_request_leave, name="request_leave" ), # group management - re_path(r"^groupmanagement/requests/$", views.group_management, name="management"), - re_path(r"^groupmanagement/membership/$", views.group_membership, name="membership"), - re_path( - r"^groupmanagement/membership/(\w+)/$", + path("groupmanagement/requests/", views.group_management, name="management"), + path("groupmanagement/membership/", views.group_membership, name="membership"), + path( + "groupmanagement/membership//", views.group_membership_list, name="membership", ), - re_path( - r"^groupmanagement/membership/(\w+)/audit-log/$", + path( + "groupmanagement/membership//audit-log/", views.group_membership_audit, name="audit_log", ), - re_path( - r"^groupmanagement/membership/(\w+)/remove/(\w+)/$", + path( + "groupmanagement/membership//remove//", views.group_membership_remove, name="membership_remove", ), - re_path( - r"^groupmanagement/request/join/accept/(\w+)/$", + path( + "groupmanagement/request/join/accept//", views.group_accept_request, name="accept_request", ), - re_path( - r"^groupmanagement/request/join/reject/(\w+)/$", + path( + "groupmanagement/request/join/reject//", views.group_reject_request, name="reject_request", ), - re_path( - r"^groupmanagement/request/leave/accept/(\w+)/$", + path( + "groupmanagement/request/leave/accept//", views.group_leave_accept_request, name="leave_accept_request", ), - re_path( - r"^groupmanagement/request/leave/reject/(\w+)/$", + path( + "groupmanagement/request/leave/reject//", views.group_leave_reject_request, name="leave_reject_request", ), diff --git a/allianceauth/hrapplications/urls.py b/allianceauth/hrapplications/urls.py index e6dc2783..8f993d5f 100644 --- a/allianceauth/hrapplications/urls.py +++ b/allianceauth/hrapplications/urls.py @@ -1,31 +1,31 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = 'hrapplications' urlpatterns = [ - re_path(r'^$', views.hr_application_management_view, + path('', views.hr_application_management_view, name="index"), - re_path(r'^create/$', views.hr_application_create_view, + path('create/', views.hr_application_create_view, name="create_view"), - re_path(r'^create/(\d+)', views.hr_application_create_view, + path('create//', views.hr_application_create_view, name="create_view"), - re_path(r'^remove/(\w+)', views.hr_application_remove, + path('remove//', views.hr_application_remove, name="remove"), - re_path(r'^view/(\w+)', views.hr_application_view, + path('view//', views.hr_application_view, name="view"), - re_path(r'^personal/view/(\w+)', views.hr_application_personal_view, + path('personal/view//', views.hr_application_personal_view, name="personal_view"), - re_path(r'^personal/removal/(\w+)', + path('personal/removal//', views.hr_application_personal_removal, name="personal_removal"), - re_path(r'^approve/(\w+)', views.hr_application_approve, + path('approve//', views.hr_application_approve, name="approve"), - re_path(r'^reject/(\w+)', views.hr_application_reject, + path('reject//', views.hr_application_reject, name="reject"), - re_path(r'^search/', views.hr_application_search, + path('search/', views.hr_application_search, name="search"), - re_path(r'^mark_in_progress/(\w+)', views.hr_application_mark_in_progress, + path('mark_in_progress//', views.hr_application_mark_in_progress, name="mark_in_progress"), - ] +] diff --git a/allianceauth/notifications/urls.py b/allianceauth/notifications/urls.py index b9e849ad..694a700b 100644 --- a/allianceauth/notifications/urls.py +++ b/allianceauth/notifications/urls.py @@ -1,16 +1,16 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = 'notifications' # Notifications urlpatterns = [ - re_path(r'^remove_notifications/(\w+)/$', views.remove_notification, name='remove'), - re_path(r'^notifications/mark_all_read/$', views.mark_all_read, name='mark_all_read'), - re_path(r'^notifications/delete_all_read/$', views.delete_all_read, name='delete_all_read'), - re_path(r'^notifications/$', views.notification_list, name='list'), - re_path(r'^notifications/(\w+)/$', views.notification_view, name='view'), - re_path( - r'^user_notifications_count/(?P\d+)/$', + path('remove_notifications//', views.remove_notification, name='remove'), + path('notifications/mark_all_read/', views.mark_all_read, name='mark_all_read'), + path('notifications/delete_all_read/', views.delete_all_read, name='delete_all_read'), + path('notifications/', views.notification_list, name='list'), + path('notifications//', views.notification_view, name='view'), + path( + 'user_notifications_count//', views.user_notifications_count, name='user_notifications_count' ), diff --git a/allianceauth/optimer/urls.py b/allianceauth/optimer/urls.py index a90a9f5f..7dba220d 100644 --- a/allianceauth/optimer/urls.py +++ b/allianceauth/optimer/urls.py @@ -1,12 +1,12 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = 'optimer' urlpatterns = [ - re_path(r'^$', views.optimer_view, name='view'), - re_path(r'^add$', views.add_optimer_view, name='add'), - re_path(r'^(\w+)/remove$', views.remove_optimer, name='remove'), - re_path(r'^(\w+)/edit$', views.edit_optimer, name='edit'), - ] + path('', views.optimer_view, name='view'), + path('add/', views.add_optimer_view, name='add'), + path('/remove/', views.remove_optimer, name='remove'), + path('/edit/', views.edit_optimer, name='edit'), +] diff --git a/allianceauth/permissions_tool/urls.py b/allianceauth/permissions_tool/urls.py index bf4b1c04..7a66c19a 100644 --- a/allianceauth/permissions_tool/urls.py +++ b/allianceauth/permissions_tool/urls.py @@ -1,11 +1,12 @@ from django.urls import re_path +from django.urls import path from . import views app_name = 'permissions_tool' urlpatterns = [ - re_path(r'^overview/$', views.permissions_overview, name='overview'), + path('overview/', views.permissions_overview, name='overview'), re_path(r'^audit/(?P[\w\-_]+)/(?P[\w\-_]+)/(?P[\w\-_]+)/$', views.permissions_audit, name='audit'), ] diff --git a/allianceauth/services/modules/discord/urls.py b/allianceauth/services/modules/discord/urls.py index 3e9af992..749a8090 100644 --- a/allianceauth/services/modules/discord/urls.py +++ b/allianceauth/services/modules/discord/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,13 +7,13 @@ app_name = 'discord' module_urls = [ # Discord Service Control - re_path(r'^activate/$', views.activate_discord, name='activate'), - re_path(r'^deactivate/$', views.deactivate_discord, name='deactivate'), - re_path(r'^reset/$', views.reset_discord, name='reset'), - re_path(r'^callback/$', views.discord_callback, name='callback'), - re_path(r'^add_bot/$', views.discord_add_bot, name='add_bot'), + path('activate/', views.activate_discord, name='activate'), + path('deactivate/', views.deactivate_discord, name='deactivate'), + path('reset/', views.reset_discord, name='reset'), + path('callback/', views.discord_callback, name='callback'), + path('add_bot/', views.discord_add_bot, name='add_bot'), ] urlpatterns = [ - re_path(r'^discord/', include((module_urls, app_name), namespace=app_name)) + path('discord/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/discourse/urls.py b/allianceauth/services/modules/discourse/urls.py index e0cd1e7b..3ca948a1 100644 --- a/allianceauth/services/modules/discourse/urls.py +++ b/allianceauth/services/modules/discourse/urls.py @@ -1,8 +1,8 @@ -from django.urls import re_path +from django.urls import path from . import views urlpatterns = [ # Discourse Service Control - re_path(r'^discourse/sso$', views.discourse_sso, name='auth_discourse_sso'), + path('discourse/sso', views.discourse_sso, name='auth_discourse_sso'), ] diff --git a/allianceauth/services/modules/example/urls.py b/allianceauth/services/modules/example/urls.py index fb1edaad..cefb0650 100644 --- a/allianceauth/services/modules/example/urls.py +++ b/allianceauth/services/modules/example/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path app_name = 'example' @@ -8,5 +8,5 @@ module_urls = [ ] urlpatterns = [ - re_path(r'^example/', include((module_urls, app_name), namespace=app_name)), + path('example/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/ips4/urls.py b/allianceauth/services/modules/ips4/urls.py index ceaf9572..87c9ca31 100644 --- a/allianceauth/services/modules/ips4/urls.py +++ b/allianceauth/services/modules/ips4/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,12 +7,12 @@ app_name = 'ips4' module_urls = [ # IPS4 Service Control - re_path(r'^activate/$', views.activate_ips4, name='activate'), - re_path(r'^deactivate/$', views.deactivate_ips4, name='deactivate'), - re_path(r'^reset_password/$', views.reset_ips4_password, name='reset_password'), - re_path(r'^set_password/$', views.set_ips4_password, name='set_password'), + path('activate/', views.activate_ips4, name='activate'), + path('deactivate/', views.deactivate_ips4, name='deactivate'), + path('reset_password/', views.reset_ips4_password, name='reset_password'), + path('set_password/', views.set_ips4_password, name='set_password'), ] urlpatterns = [ - re_path(r'^ips4/', include((module_urls, app_name), namespace=app_name)) + path('ips4/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/mumble/urls.py b/allianceauth/services/modules/mumble/urls.py index 586342e3..6c403fc2 100644 --- a/allianceauth/services/modules/mumble/urls.py +++ b/allianceauth/services/modules/mumble/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,12 +7,12 @@ app_name = 'mumble' module_urls = [ # Mumble service control - re_path(r'^activate/$', views.CreateAccountMumbleView.as_view(), name='activate'), - re_path(r'^deactivate/$', views.DeleteMumbleView.as_view(), name='deactivate'), - re_path(r'^reset_password/$', views.ResetPasswordMumbleView.as_view(), name='reset_password'), - re_path(r'^set_password/$', views.SetPasswordMumbleView.as_view(), name='set_password'), + path('activate/', views.CreateAccountMumbleView.as_view(), name='activate'), + path('deactivate/', views.DeleteMumbleView.as_view(), name='deactivate'), + path('reset_password/', views.ResetPasswordMumbleView.as_view(), name='reset_password'), + path('set_password/', views.SetPasswordMumbleView.as_view(), name='set_password'), ] urlpatterns = [ - re_path(r'^mumble/', include((module_urls, app_name), namespace=app_name)) + path('mumble/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/openfire/urls.py b/allianceauth/services/modules/openfire/urls.py index e24319f2..8823ad18 100644 --- a/allianceauth/services/modules/openfire/urls.py +++ b/allianceauth/services/modules/openfire/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,13 +7,13 @@ app_name = 'openfire' module_urls = [ # Jabber Service Control - re_path(r'^activate/$', views.activate_jabber, name='activate'), - re_path(r'^deactivate/$', views.deactivate_jabber, name='deactivate'), - re_path(r'^reset_password/$', views.reset_jabber_password, name='reset_password'), - re_path(r'^set_password/$', views.set_jabber_password, name='set_password'), - re_path(r'^broadcast/$', views.jabber_broadcast_view, name='broadcast'), + path('activate/', views.activate_jabber, name='activate'), + path('deactivate/', views.deactivate_jabber, name='deactivate'), + path('reset_password/', views.reset_jabber_password, name='reset_password'), + path('set_password/', views.set_jabber_password, name='set_password'), + path('broadcast/', views.jabber_broadcast_view, name='broadcast'), ] urlpatterns = [ - re_path(r'^openfire/', include((module_urls, app_name), namespace=app_name)), + path('openfire/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/phpbb3/urls.py b/allianceauth/services/modules/phpbb3/urls.py index a9de3356..d7d7bce9 100644 --- a/allianceauth/services/modules/phpbb3/urls.py +++ b/allianceauth/services/modules/phpbb3/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,12 +7,12 @@ app_name = 'phpbb3' module_urls = [ # Forum Service Control - re_path(r'^activate/$', views.activate_forum, name='activate'), - re_path(r'^deactivate/$', views.deactivate_forum, name='deactivate'), - re_path(r'^reset_password/$', views.reset_forum_password, name='reset_password'), - re_path(r'^set_password/$', views.set_forum_password, name='set_password'), + path('activate/', views.activate_forum, name='activate'), + path('deactivate/', views.deactivate_forum, name='deactivate'), + path('reset_password/', views.reset_forum_password, name='reset_password'), + path('set_password/', views.set_forum_password, name='set_password'), ] urlpatterns = [ - re_path(r'^phpbb3/', include((module_urls, app_name), namespace=app_name)) + path('phpbb3/', include((module_urls, app_name), namespace=app_name)) ] diff --git a/allianceauth/services/modules/smf/urls.py b/allianceauth/services/modules/smf/urls.py index e5a079b4..92aba143 100644 --- a/allianceauth/services/modules/smf/urls.py +++ b/allianceauth/services/modules/smf/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,12 +7,12 @@ app_name = 'smf' module_urls = [ # SMF Service Control - re_path(r'^activate/$', views.activate_smf, name='activate'), - re_path(r'^deactivate/$', views.deactivate_smf, name='deactivate'), - re_path(r'^reset_password/$', views.reset_smf_password, name='reset_password'), - re_path(r'^set_password/$', views.set_smf_password, name='set_password'), + path('activate/', views.activate_smf, name='activate'), + path('deactivate/', views.deactivate_smf, name='deactivate'), + path('reset_password/', views.reset_smf_password, name='reset_password'), + path('set_password/', views.set_smf_password, name='set_password'), ] urlpatterns = [ - re_path(r'^smf/', include((module_urls, app_name), namespace=app_name)), + path('smf/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/teamspeak3/urls.py b/allianceauth/services/modules/teamspeak3/urls.py index 420753fa..4c6831e3 100644 --- a/allianceauth/services/modules/teamspeak3/urls.py +++ b/allianceauth/services/modules/teamspeak3/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,19 +7,19 @@ app_name = 'teamspeak3' module_urls = [ # Teamspeak3 service control - re_path(r'^activate/$', views.activate_teamspeak3, name='activate'), - re_path(r'^deactivate/$', views.deactivate_teamspeak3, name='deactivate'), - re_path(r'^reset_perm/$', views.reset_teamspeak3_perm, name='reset_perm'), - re_path( - r'^admin_update_ts3_groups/$', + path('activate/', views.activate_teamspeak3, name='activate'), + path('deactivate/', views.deactivate_teamspeak3, name='deactivate'), + path('reset_perm/', views.reset_teamspeak3_perm, name='reset_perm'), + path( + 'admin_update_ts3_groups/', views.admin_update_ts3_groups, name='admin_update_ts3_groups' ), # Teamspeak Urls - re_path(r'^verify/$', views.verify_teamspeak3, name='verify'), + path('verify/', views.verify_teamspeak3, name='verify'), ] urlpatterns = [ - re_path(r'^teamspeak3/', include((module_urls, app_name), namespace=app_name)), + path('teamspeak3/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/modules/xenforo/urls.py b/allianceauth/services/modules/xenforo/urls.py index bcb6a2a2..9bad105e 100644 --- a/allianceauth/services/modules/xenforo/urls.py +++ b/allianceauth/services/modules/xenforo/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import include -from django.urls import re_path +from django.urls import path from . import views @@ -7,12 +7,12 @@ app_name = 'xenforo' module_urls = [ # XenForo service control - re_path(r'^activate/$', views.activate_xenforo_forum, name='activate'), - re_path(r'^deactivate/$', views.deactivate_xenforo_forum, name='deactivate'), - re_path(r'^reset_password/$', views.reset_xenforo_password, name='reset_password'), - re_path(r'^set_password/$', views.set_xenforo_password, name='set_password'), + path('activate/', views.activate_xenforo_forum, name='activate'), + path('deactivate/', views.deactivate_xenforo_forum, name='deactivate'), + path('reset_password/', views.reset_xenforo_password, name='reset_password'), + path('set_password/', views.set_xenforo_password, name='set_password'), ] urlpatterns = [ - re_path(r'^xenforo/', include((module_urls, app_name), namespace=app_name)), + path('xenforo/', include((module_urls, app_name), namespace=app_name)), ] diff --git a/allianceauth/services/urls.py b/allianceauth/services/urls.py index c7a0fb41..e43b0e30 100644 --- a/allianceauth/services/urls.py +++ b/allianceauth/services/urls.py @@ -1,15 +1,15 @@ from django.conf.urls import include from allianceauth.hooks import get_hooks -from django.urls import re_path +from django.urls import path from . import views urlpatterns = [ # Services - re_path(r'^services/', include(([ - re_path(r'^$', views.services_view, name='services'), + path('services/', include(([ + path('', views.services_view, name='services'), # Tools - re_path(r'^tool/fleet_formatter_tool/$', views.fleet_formatter_view, name='fleet_format_tool'), + path('tool/fleet_formatter_tool/', views.fleet_formatter_view, name='fleet_format_tool'), ], 'services'), namespace='services')), ] diff --git a/allianceauth/srp/urls.py b/allianceauth/srp/urls.py index 45f8fab8..8953e007 100644 --- a/allianceauth/srp/urls.py +++ b/allianceauth/srp/urls.py @@ -1,4 +1,4 @@ -from django.urls import re_path +from django.urls import path from . import views @@ -6,27 +6,27 @@ app_name = 'srp' urlpatterns = [ # SRP URLS - re_path(r'^$', views.srp_management, name='management'), - re_path(r'^all/$', views.srp_management, {'all': True}, name='all'), - re_path(r'^(\w+)/view$', views.srp_fleet_view, name='fleet'), - re_path(r'^add/$', views.srp_fleet_add_view, name='add'), - re_path(r'^(\w+)/edit$', views.srp_fleet_edit_view, name='edit'), - re_path(r'^(\w+)/request', views.srp_request_view, name='request'), + path('', views.srp_management, name='management'), + path('all/', views.srp_management, {'all': True}, name='all'), + path('/view/', views.srp_fleet_view, name='fleet'), + path('add/', views.srp_fleet_add_view, name='add'), + path('/edit/', views.srp_fleet_edit_view, name='edit'), + path('/request', views.srp_request_view, name='request'), # SRP URLS - re_path(r'^(\w+)/remove$', views.srp_fleet_remove, name='remove'), - re_path(r'^(\w+)/disable$', views.srp_fleet_disable, name='disable'), - re_path(r'^(\w+)/enable$', views.srp_fleet_enable, name='enable'), - re_path(r'^(\w+)/complete$', views.srp_fleet_mark_completed, + path('/remove/', views.srp_fleet_remove, name='remove'), + path('/disable/', views.srp_fleet_disable, name='disable'), + path('/enable/', views.srp_fleet_enable, name='enable'), + path('/complete/', views.srp_fleet_mark_completed, name='mark_completed'), - re_path(r'^(\w+)/incomplete$', views.srp_fleet_mark_uncompleted, + path('/incomplete/', views.srp_fleet_mark_uncompleted, name='mark_uncompleted'), - re_path(r'^request/remove/', views.srp_request_remove, + path('request/remove/', views.srp_request_remove, name="request_remove"), - re_path(r'^request/approve/', views.srp_request_approve, + path('request/approve/', views.srp_request_approve, name='request_approve'), - re_path(r'^request/reject/', views.srp_request_reject, + path('request/reject/', views.srp_request_reject, name='request_reject'), - re_path(r'^request/(\w+)/update', views.srp_request_update_amount, + path('request//update', views.srp_request_update_amount, name="request_update_amount"), ] diff --git a/allianceauth/timerboard/urls.py b/allianceauth/timerboard/urls.py index c9de7a5c..bf864c45 100644 --- a/allianceauth/timerboard/urls.py +++ b/allianceauth/timerboard/urls.py @@ -1,12 +1,12 @@ -from django.urls import re_path +from django.urls import path from . import views app_name = 'timerboard' urlpatterns = [ - re_path(r'^$', views.TimerView.as_view(), name='view'), - re_path(r'^add/$', views.AddTimerView.as_view(), name='add'), - re_path(r'^remove/(?P\w+)$', views.RemoveTimerView.as_view(), name='delete'), - re_path(r'^edit/(?P\w+)$', views.EditTimerView.as_view(), name='edit'), + path('', views.TimerView.as_view(), name='view'), + path('add/', views.AddTimerView.as_view(), name='add'), + path('remove//', views.RemoveTimerView.as_view(), name='delete'), + path('edit//', views.EditTimerView.as_view(), name='edit'), ] diff --git a/allianceauth/urls.py b/allianceauth/urls.py index 6e50722b..3a8ea22c 100755 --- a/allianceauth/urls.py +++ b/allianceauth/urls.py @@ -1,4 +1,4 @@ -from django.urls import re_path +from django.urls import path import esi.urls from django.conf.urls import include @@ -22,35 +22,35 @@ admin.site.site_header = NAME # Functional/Untranslated URL's urlpatterns = [ # Locale - re_path(r'^i18n/', include('django.conf.urls.i18n')), + path('i18n/', include('django.conf.urls.i18n')), # Authentication - 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)), + path('', include(allianceauth.authentication.urls)), + path('account/login/', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'), + path('account/', include(hmac_urls)), # Admin urls - re_path(r'^admin/', admin.site.urls), + path('admin/', admin.site.urls), # SSO - re_path(r'^sso/', include((esi.urls, 'esi'), namespace='esi')), - re_path(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'), + path('sso/', include((esi.urls, 'esi'), namespace='esi')), + path('sso/login', allianceauth.authentication.views.sso_login, name='auth_sso_login'), # Notifications - re_path(r'', include(allianceauth.notifications.urls)), + path('', include(allianceauth.notifications.urls)), # Groups - re_path(r'', include(allianceauth.groupmanagement.urls)), + path('', include(allianceauth.groupmanagement.urls)), # Services - re_path(r'', decorate_url_patterns(allianceauth.services.urls.urlpatterns, main_character_required)), + path('', decorate_url_patterns(allianceauth.services.urls.urlpatterns, main_character_required)), # Night mode - re_path(r'^night/', views.NightModeRedirectView.as_view(), name='nightmode') + path('night/', views.NightModeRedirectView.as_view(), name='nightmode') ] # Append app urls app_urls = get_hooks('url_hook') for app in app_urls: - urlpatterns += [re_path(r'', decorate_url_patterns([app().include_pattern], main_character_required))] + urlpatterns += [path('', decorate_url_patterns([app().include_pattern], main_character_required))] diff --git a/tests/urls.py b/tests/urls.py index 423ce0c0..ba840b33 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,17 +1,17 @@ import allianceauth.urls -from django.urls import re_path +from django.urls import path from . import views urlpatterns = allianceauth.urls.urlpatterns urlpatterns += [ # Navhelper test urls - re_path(r'^main-page/$', views.page, name='p1'), - re_path(r'^main-page/sub-section/$', views.page, name='p1-s1'), - re_path(r'^second-page/$', views.page, name='p1'), + path("main-page/", views.page, name="p1"), + path("main-page/sub-section/", views.page, name="p1-s1"), + path("second-page/", views.page, name="p1"), ] -handler500 = 'allianceauth.views.Generic500Redirect' -handler404 = 'allianceauth.views.Generic404Redirect' -handler403 = 'allianceauth.views.Generic403Redirect' -handler400 = 'allianceauth.views.Generic400Redirect' +handler500 = "allianceauth.views.Generic500Redirect" +handler404 = "allianceauth.views.Generic404Redirect" +handler403 = "allianceauth.views.Generic403Redirect" +handler400 = "allianceauth.views.Generic400Redirect" From c74010d4413ee7063943b7e2597b804d43514abc Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 2 Feb 2022 15:25:45 +0100 Subject: [PATCH 11/14] Docs updated --- docs/customizing/index.md | 13 +++++++++++-- docs/development/custom/url-hooks.md | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/customizing/index.md b/docs/customizing/index.md index 6105589d..f7cf5971 100644 --- a/docs/customizing/index.md +++ b/docs/customizing/index.md @@ -30,6 +30,9 @@ It is possible to overload static and templates shipped with Django or Alliance It is possible to add or override URLs with your auth project's URL config file. Upon install it is of the form: ```python +from django.urls import re_path +from django.urls import include + import allianceauth.urls urlpatterns = [ @@ -42,23 +45,29 @@ This means every request gets passed to the Alliance Auth URL config to be inter If you wanted to add a URL pointing to a custom view, it can be added anywhere in the list if not already used by Alliance Auth: ```python +from django.urls import re_path +from django.urls import include, path + import allianceauth.urls import myauth.views urlpatterns = [ re_path(r'', include(allianceauth.urls)), - re_path(r'myview/$', myauth.views.myview, name='myview'), + path('myview/', myauth.views.myview, name='myview'), ] ``` Additionally you can override URLs used by Alliance Auth here: ```python +from django.urls import re_path +from django.urls import include, path + import allianceauth.urls import myauth.views urlpatterns = [ - re_path(r'account/login/$', myauth.views.login, name='auth_login_user'), + path('account/login/', myauth.views.login, name='auth_login_user'), re_path(r'', include(allianceauth.urls)), ] ``` diff --git a/docs/development/custom/url-hooks.md b/docs/development/custom/url-hooks.md index d0698351..f9d76d56 100644 --- a/docs/development/custom/url-hooks.md +++ b/docs/development/custom/url-hooks.md @@ -34,12 +34,12 @@ An app called `plugin` provides a single view: The app's `urls.py` would look like so: - from django.conf.urls import url + from django.urls import path import plugin.views urlpatterns = [ - re_path(r^'index$', plugins.views.index, name='index'), - ] + path('index/', plugins.views.index, name='index'), + ] Subsequently it would implement the UrlHook in a dedicated `auth_hooks.py` file like so: From 91668866656da25bf4dc6f12ce8440db767e08e5 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 2 Feb 2022 15:27:07 +0100 Subject: [PATCH 12/14] That one slipped through the cracks ... --- allianceauth/authentication/hmac_urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/authentication/hmac_urls.py b/allianceauth/authentication/hmac_urls.py index 8e7f3128..ba8fb03e 100644 --- a/allianceauth/authentication/hmac_urls.py +++ b/allianceauth/authentication/hmac_urls.py @@ -5,7 +5,7 @@ from django.urls import re_path from django.urls import path urlpatterns = [ - path(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'), + path('^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. re_path(r'^activate/(?P[-:\w]+)/$', views.ActivationView.as_view(), name='registration_activate'), From b14bff0145e85c27827d90243b725cee2c45bbc8 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 2 Feb 2022 15:28:36 +0100 Subject: [PATCH 13/14] We should do this properly .. --- allianceauth/authentication/hmac_urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allianceauth/authentication/hmac_urls.py b/allianceauth/authentication/hmac_urls.py index ba8fb03e..e7c03d11 100644 --- a/allianceauth/authentication/hmac_urls.py +++ b/allianceauth/authentication/hmac_urls.py @@ -5,7 +5,7 @@ from django.urls import re_path from django.urls import path urlpatterns = [ - path('^activate/complete/$', views.activation_complete, name='registration_activation_complete'), + path('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. re_path(r'^activate/(?P[-:\w]+)/$', views.ActivationView.as_view(), name='registration_activate'), From 60c2e57d83dc1de09002319b8e9fe56e1be86cd3 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Wed, 2 Feb 2022 16:12:43 +0100 Subject: [PATCH 14/14] Fix ifequal errors --- .../mumble/templates/services/mumble/mumble_service_ctrl.html | 4 ++-- .../services/teamspeak3/teamspeak3_service_ctrl.html | 4 ++-- allianceauth/services/templates/services/services_ctrl.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html b/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html index e818b7db..8415ba77 100644 --- a/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html +++ b/allianceauth/services/modules/mumble/templates/services/mumble/mumble_service_ctrl.html @@ -3,7 +3,7 @@ {{ username }} {{ service_url }} - {% ifequal username "" %} + {% if username == "" %} @@ -20,6 +20,6 @@ - {% endifequal %} + {% endif %} diff --git a/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html index a88f61d7..3b3ba578 100644 --- a/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html +++ b/allianceauth/services/modules/teamspeak3/templates/services/teamspeak3/teamspeak3_service_ctrl.html @@ -5,7 +5,7 @@ {{ authinfo.teamspeak3_uid }} {{ TEAMSPEAK3_PUBLIC_URL }} - {% ifequal authinfo.teamspeak3_uid "" %} + {% if authinfo.teamspeak3_uid == "" %} @@ -22,6 +22,6 @@ - {% endifequal %} + {% endif %} diff --git a/allianceauth/services/templates/services/services_ctrl.html b/allianceauth/services/templates/services/services_ctrl.html index f34f9a8e..8bd84fde 100644 --- a/allianceauth/services/templates/services/services_ctrl.html +++ b/allianceauth/services/templates/services/services_ctrl.html @@ -5,7 +5,7 @@ {{ username }} {{ service_url }} - {% ifequal username "" %} + {% if username == "" %} {% if urls.auth_activate %} @@ -27,6 +27,6 @@ {% endif %} - {% endifequal %} + {% endif %}