From cd2b2f5f2cb92779aa03ba4096c2cbc92bc00c39 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 15 Sep 2021 19:47:55 -0700 Subject: [PATCH] *: Use django.urls.re_path() instead of its alias url() - In Django 2.2 django.conf.urls.url() is an alias to django.urls.re_path(). - In Django 4.0, url() function will be removed. On Django 3.2, it throws a warning that this function will be removed in future. Tests: - Run unit tests with Django 3.2 and Django 2.2. - With Django 3.2 there are no warnings when running unit tests and when running FreedomBox Service. - Visit a few affected apps with both Django versions. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- doc/dev/tutorial/view.rst | 4 +- plinth/module_loader.py | 4 +- plinth/modules/api/urls.py | 7 +-- plinth/modules/avahi/urls.py | 4 +- plinth/modules/backups/urls.py | 54 ++++++++++----------- plinth/modules/bepasty/urls.py | 10 ++-- plinth/modules/bind/urls.py | 4 +- plinth/modules/calibre/urls.py | 12 ++--- plinth/modules/cockpit/urls.py | 4 +- plinth/modules/config/urls.py | 4 +- plinth/modules/coturn/urls.py | 4 +- plinth/modules/datetime/urls.py | 4 +- plinth/modules/deluge/urls.py | 4 +- plinth/modules/diagnostics/urls.py | 8 ++-- plinth/modules/diaspora/urls.py | 7 +-- plinth/modules/dynamicdns/urls.py | 9 ++-- plinth/modules/ejabberd/urls.py | 4 +- plinth/modules/firewall/urls.py | 4 +- plinth/modules/first_boot/urls.py | 10 ++-- plinth/modules/gitweb/urls.py | 10 ++-- plinth/modules/help/urls.py | 33 ++++++------- plinth/modules/i2p/urls.py | 6 ++- plinth/modules/ikiwiki/urls.py | 9 ++-- plinth/modules/infinoted/urls.py | 6 +-- plinth/modules/jsxc/urls.py | 6 +-- plinth/modules/letsencrypt/urls.py | 20 ++++---- plinth/modules/matrixsynapse/urls.py | 8 ++-- plinth/modules/mediawiki/urls.py | 4 +- plinth/modules/minetest/urls.py | 4 +- plinth/modules/minidlna/urls.py | 4 +- plinth/modules/mldonkey/urls.py | 5 +- plinth/modules/monkeysphere/urls.py | 18 +++---- plinth/modules/mumble/urls.py | 4 +- plinth/modules/names/urls.py | 4 +- plinth/modules/networks/urls.py | 70 +++++++++++++++------------- plinth/modules/openvpn/urls.py | 12 ++--- plinth/modules/pagekite/urls.py | 12 ++--- plinth/modules/performance/urls.py | 6 +-- plinth/modules/power/urls.py | 8 ++-- plinth/modules/privoxy/urls.py | 5 +- plinth/modules/quassel/urls.py | 4 +- plinth/modules/radicale/urls.py | 4 +- plinth/modules/roundcube/urls.py | 6 +-- plinth/modules/samba/urls.py | 8 ++-- plinth/modules/searx/urls.py | 4 +- plinth/modules/security/urls.py | 6 +-- plinth/modules/shaarli/urls.py | 5 +- plinth/modules/shadowsocks/urls.py | 5 +- plinth/modules/sharing/urls.py | 13 +++--- plinth/modules/snapshot/urls.py | 14 +++--- plinth/modules/ssh/urls.py | 4 +- plinth/modules/sso/urls.py | 10 ++-- plinth/modules/storage/urls.py | 10 ++-- plinth/modules/syncthing/urls.py | 6 +-- plinth/modules/tahoe/urls.py | 14 +++--- plinth/modules/tor/urls.py | 4 +- plinth/modules/transmission/urls.py | 5 +- plinth/modules/ttrss/urls.py | 4 +- plinth/modules/upgrades/urls.py | 27 +++++------ plinth/modules/users/urls.py | 33 +++++++------ plinth/modules/wireguard/urls.py | 36 +++++++------- plinth/modules/wordpress/urls.py | 6 +-- plinth/modules/zoph/urls.py | 6 +-- plinth/tests/data/urls.py | 11 +++-- plinth/urls.py | 37 ++++++++------- 65 files changed, 359 insertions(+), 338 deletions(-) diff --git a/doc/dev/tutorial/view.rst b/doc/dev/tutorial/view.rst index 29c2a79c8..b532883e3 100644 --- a/doc/dev/tutorial/view.rst +++ b/doc/dev/tutorial/view.rst @@ -13,12 +13,12 @@ write the following: .. code-block:: python3 :caption: ``urls.py`` - from django.conf.urls import url + from django.urls import re_path from .views import TransmissionAppView urlpatterns = [ - url(r'^apps/transmission/$', TransmissionAppView.as_view(), name='index'), + re_path(r'^apps/transmission/$', TransmissionAppView.as_view(), name='index'), ] This routes the ``/apps/transmission/`` URL to a view called diff --git a/plinth/module_loader.py b/plinth/module_loader.py index 420c4a0e7..9b53184a7 100644 --- a/plinth/module_loader.py +++ b/plinth/module_loader.py @@ -109,8 +109,8 @@ def _include_module_urls(module_import_path, module_name): url_module = module_import_path + '.urls' try: urls.urlpatterns += [ - django.conf.urls.url( - r'', django.conf.urls.include((url_module, module_name))) + django.urls.re_path(r'', + django.urls.include((url_module, module_name))) ] except ImportError: logger.debug('No URLs for %s', module_name) diff --git a/plinth/modules/api/urls.py b/plinth/modules/api/urls.py index 612860ab8..b25a2d55f 100644 --- a/plinth/modules/api/urls.py +++ b/plinth/modules/api/urls.py @@ -3,12 +3,13 @@ URLs for the plinth api for android app. """ -from django.conf.urls import url +from django.urls import re_path from stronghold.decorators import public from plinth.modules.api import views urlpatterns = [ - url(r'^api/(?P[0-9]+)/shortcuts/?$', public(views.shortcuts)), - url(r'^api/(?P[0-9]+)/access-info/?$', public(views.access_info)), + re_path(r'^api/(?P[0-9]+)/shortcuts/?$', public(views.shortcuts)), + re_path(r'^api/(?P[0-9]+)/access-info/?$', + public(views.access_info)), ] diff --git a/plinth/modules/avahi/urls.py b/plinth/modules/avahi/urls.py index 698c721de..19197cbd7 100644 --- a/plinth/modules/avahi/urls.py +++ b/plinth/modules/avahi/urls.py @@ -3,10 +3,10 @@ URLs for the service discovery module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^sys/avahi/$', AppView.as_view(app_id='avahi'), name='index'), + re_path(r'^sys/avahi/$', AppView.as_view(app_id='avahi'), name='index'), ] diff --git a/plinth/modules/backups/urls.py b/plinth/modules/backups/urls.py index 86f43e9d0..fc9cdad03 100644 --- a/plinth/modules/backups/urls.py +++ b/plinth/modules/backups/urls.py @@ -3,7 +3,7 @@ URLs for the backups module. """ -from django.conf.urls import url +from django.urls import re_path from .views import (AddRemoteRepositoryView, AddRepositoryView, CreateArchiveView, DeleteArchiveView, DownloadArchiveView, @@ -12,29 +12,31 @@ from .views import (AddRemoteRepositoryView, AddRepositoryView, VerifySshHostkeyView, mount_repository, umount_repository) urlpatterns = [ - url(r'^sys/backups/$', IndexView.as_view(), name='index'), - url(r'^sys/backups/(?P[^/]+)/schedule/$', ScheduleView.as_view(), - name='schedule'), - url(r'^sys/backups/create/$', CreateArchiveView.as_view(), name='create'), - url(r'^sys/backups/(?P[^/]+)/download/(?P[^/]+)/$', - DownloadArchiveView.as_view(), name='download'), - url(r'^sys/backups/(?P[^/]+)/delete/(?P[^/]+)/$', - DeleteArchiveView.as_view(), name='delete'), - url(r'^sys/backups/upload/$', UploadArchiveView.as_view(), name='upload'), - url(r'^sys/backups/(?P[^/]+)/restore-archive/(?P[^/]+)/$', - RestoreArchiveView.as_view(), name='restore-archive'), - url(r'^sys/backups/restore-from-upload/$', RestoreFromUploadView.as_view(), - name='restore-from-upload'), - url(r'^sys/backups/repositories/add/$', AddRepositoryView.as_view(), - name='add-repository'), - url(r'^sys/backups/repositories/add-remote/$', - AddRemoteRepositoryView.as_view(), name='add-remote-repository'), - url(r'^sys/backups/repositories/(?P[^/]+)/ssh-verify/$', - VerifySshHostkeyView.as_view(), name='verify-ssh-hostkey'), - url(r'^sys/backups/repositories/(?P[^/]+)/delete/$', - RemoveRepositoryView.as_view(), name='repository-remove'), - url(r'^sys/backups/repositories/(?P[^/]+)/mount/$', mount_repository, - name='repository-mount'), - url(r'^sys/backups/repositories/(?P[^/]+)/umount/$', - umount_repository, name='repository-umount'), + re_path(r'^sys/backups/$', IndexView.as_view(), name='index'), + re_path(r'^sys/backups/(?P[^/]+)/schedule/$', ScheduleView.as_view(), + name='schedule'), + re_path(r'^sys/backups/create/$', CreateArchiveView.as_view(), + name='create'), + re_path(r'^sys/backups/(?P[^/]+)/download/(?P[^/]+)/$', + DownloadArchiveView.as_view(), name='download'), + re_path(r'^sys/backups/(?P[^/]+)/delete/(?P[^/]+)/$', + DeleteArchiveView.as_view(), name='delete'), + re_path(r'^sys/backups/upload/$', UploadArchiveView.as_view(), + name='upload'), + re_path(r'^sys/backups/(?P[^/]+)/restore-archive/(?P[^/]+)/$', + RestoreArchiveView.as_view(), name='restore-archive'), + re_path(r'^sys/backups/restore-from-upload/$', + RestoreFromUploadView.as_view(), name='restore-from-upload'), + re_path(r'^sys/backups/repositories/add/$', AddRepositoryView.as_view(), + name='add-repository'), + re_path(r'^sys/backups/repositories/add-remote/$', + AddRemoteRepositoryView.as_view(), name='add-remote-repository'), + re_path(r'^sys/backups/repositories/(?P[^/]+)/ssh-verify/$', + VerifySshHostkeyView.as_view(), name='verify-ssh-hostkey'), + re_path(r'^sys/backups/repositories/(?P[^/]+)/delete/$', + RemoveRepositoryView.as_view(), name='repository-remove'), + re_path(r'^sys/backups/repositories/(?P[^/]+)/mount/$', + mount_repository, name='repository-mount'), + re_path(r'^sys/backups/repositories/(?P[^/]+)/umount/$', + umount_repository, name='repository-umount'), ] diff --git a/plinth/modules/bepasty/urls.py b/plinth/modules/bepasty/urls.py index 544703b0a..8ab5b7f52 100644 --- a/plinth/modules/bepasty/urls.py +++ b/plinth/modules/bepasty/urls.py @@ -3,13 +3,13 @@ URLs for the bepasty module. """ -from django.conf.urls import url +from django.urls import re_path from .views import AddPasswordView, BepastyView, remove urlpatterns = [ - url(r'^apps/bepasty/$', BepastyView.as_view(), name='index'), - url(r'^apps/bepasty/add/$', AddPasswordView.as_view(), name='add'), - url(r'^apps/bepasty/(?P[A-Za-z0-9]+)/remove/$', remove, - name='remove'), + re_path(r'^apps/bepasty/$', BepastyView.as_view(), name='index'), + re_path(r'^apps/bepasty/add/$', AddPasswordView.as_view(), name='add'), + re_path(r'^apps/bepasty/(?P[A-Za-z0-9]+)/remove/$', remove, + name='remove'), ] diff --git a/plinth/modules/bind/urls.py b/plinth/modules/bind/urls.py index 0deed4447..bd472ef9f 100644 --- a/plinth/modules/bind/urls.py +++ b/plinth/modules/bind/urls.py @@ -3,10 +3,10 @@ URLs for the BIND module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.bind.views import BindAppView urlpatterns = [ - url(r'^sys/bind/$', BindAppView.as_view(), name='index'), + re_path(r'^sys/bind/$', BindAppView.as_view(), name='index'), ] diff --git a/plinth/modules/calibre/urls.py b/plinth/modules/calibre/urls.py index a4cb694e3..8aa4ddeb8 100644 --- a/plinth/modules/calibre/urls.py +++ b/plinth/modules/calibre/urls.py @@ -3,14 +3,14 @@ URLs for the calibre module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^apps/calibre/$', views.CalibreAppView.as_view(), name='index'), - url(r'^apps/calibre/library/create/$', views.CreateLibraryView.as_view(), - name='create-library'), - url(r'^apps/calibre/library/(?P[a-zA-Z0-9_.-]+)/delete/$', - views.delete_library, name='delete-library'), + re_path(r'^apps/calibre/$', views.CalibreAppView.as_view(), name='index'), + re_path(r'^apps/calibre/library/create/$', + views.CreateLibraryView.as_view(), name='create-library'), + re_path(r'^apps/calibre/library/(?P[a-zA-Z0-9_.-]+)/delete/$', + views.delete_library, name='delete-library'), ] diff --git a/plinth/modules/cockpit/urls.py b/plinth/modules/cockpit/urls.py index 2326ce615..041de1146 100644 --- a/plinth/modules/cockpit/urls.py +++ b/plinth/modules/cockpit/urls.py @@ -3,10 +3,10 @@ URLs for Cockpit module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.cockpit.views import CockpitAppView urlpatterns = [ - url(r'^sys/cockpit/$', CockpitAppView.as_view(), name='index'), + re_path(r'^sys/cockpit/$', CockpitAppView.as_view(), name='index'), ] diff --git a/plinth/modules/config/urls.py b/plinth/modules/config/urls.py index b5704fc78..6d7652857 100644 --- a/plinth/modules/config/urls.py +++ b/plinth/modules/config/urls.py @@ -3,10 +3,10 @@ URLs for the Configuration module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/config/$', views.ConfigAppView.as_view(), name='index'), + re_path(r'^sys/config/$', views.ConfigAppView.as_view(), name='index'), ] diff --git a/plinth/modules/coturn/urls.py b/plinth/modules/coturn/urls.py index 7dd786ea6..f66bb1c33 100644 --- a/plinth/modules/coturn/urls.py +++ b/plinth/modules/coturn/urls.py @@ -3,10 +3,10 @@ URLs for the Coturn module. """ -from django.conf.urls import url +from django.urls import re_path from .views import CoturnAppView urlpatterns = [ - url(r'^apps/coturn/$', CoturnAppView.as_view(), name='index'), + re_path(r'^apps/coturn/$', CoturnAppView.as_view(), name='index'), ] diff --git a/plinth/modules/datetime/urls.py b/plinth/modules/datetime/urls.py index 35703bbde..d82977e98 100644 --- a/plinth/modules/datetime/urls.py +++ b/plinth/modules/datetime/urls.py @@ -3,10 +3,10 @@ URLs for the date and time module """ -from django.conf.urls import url +from django.urls import re_path from .views import DateTimeAppView urlpatterns = [ - url(r'^sys/datetime/$', DateTimeAppView.as_view(), name='index'), + re_path(r'^sys/datetime/$', DateTimeAppView.as_view(), name='index'), ] diff --git a/plinth/modules/deluge/urls.py b/plinth/modules/deluge/urls.py index 74e804d0f..cf305b2f5 100644 --- a/plinth/modules/deluge/urls.py +++ b/plinth/modules/deluge/urls.py @@ -3,10 +3,10 @@ URLs for the Deluge module. """ -from django.conf.urls import url +from django.urls import re_path from .views import DelugeAppView urlpatterns = [ - url(r'^apps/deluge/$', DelugeAppView.as_view(), name='index') + re_path(r'^apps/deluge/$', DelugeAppView.as_view(), name='index') ] diff --git a/plinth/modules/diagnostics/urls.py b/plinth/modules/diagnostics/urls.py index 63b843670..202d34db1 100644 --- a/plinth/modules/diagnostics/urls.py +++ b/plinth/modules/diagnostics/urls.py @@ -3,12 +3,12 @@ URLs for the Diagnostics module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/diagnostics/$', views.index, name='index'), - url(r'^sys/diagnostics/(?P[1-9a-z\-_]+)/$', views.diagnose_app, - name='app'), + re_path(r'^sys/diagnostics/$', views.index, name='index'), + re_path(r'^sys/diagnostics/(?P[1-9a-z\-_]+)/$', views.diagnose_app, + name='app'), ] diff --git a/plinth/modules/diaspora/urls.py b/plinth/modules/diaspora/urls.py index 710691956..cf5dd66a6 100644 --- a/plinth/modules/diaspora/urls.py +++ b/plinth/modules/diaspora/urls.py @@ -3,11 +3,12 @@ URLs for the diaspora module """ -from django.conf.urls import url +from django.urls import re_path from .views import DiasporaAppView, DiasporaSetupView urlpatterns = [ - url(r'^apps/diaspora/setup$', DiasporaSetupView.as_view(), name='setup'), - url(r'^apps/diaspora/$', DiasporaAppView.as_view(), name='index') + re_path(r'^apps/diaspora/setup$', DiasporaSetupView.as_view(), + name='setup'), + re_path(r'^apps/diaspora/$', DiasporaAppView.as_view(), name='index') ] diff --git a/plinth/modules/dynamicdns/urls.py b/plinth/modules/dynamicdns/urls.py index c5703604d..5a3e0aaf8 100644 --- a/plinth/modules/dynamicdns/urls.py +++ b/plinth/modules/dynamicdns/urls.py @@ -3,12 +3,13 @@ URLs for the dynamicdns module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/dynamicdns/$', views.index, name='index'), - url(r'^sys/dynamicdns/configure/$', views.configure, name='configure'), - url(r'^sys/dynamicdns/statuspage/$', views.statuspage, name='statuspage'), + re_path(r'^sys/dynamicdns/$', views.index, name='index'), + re_path(r'^sys/dynamicdns/configure/$', views.configure, name='configure'), + re_path(r'^sys/dynamicdns/statuspage/$', views.statuspage, + name='statuspage'), ] diff --git a/plinth/modules/ejabberd/urls.py b/plinth/modules/ejabberd/urls.py index a397039b0..3413afd00 100644 --- a/plinth/modules/ejabberd/urls.py +++ b/plinth/modules/ejabberd/urls.py @@ -3,10 +3,10 @@ URL for the Ejabberd module """ -from django.conf.urls import url +from django.urls import re_path from .views import EjabberdAppView urlpatterns = [ - url(r'^apps/ejabberd/$', EjabberdAppView.as_view(), name='index') + re_path(r'^apps/ejabberd/$', EjabberdAppView.as_view(), name='index') ] diff --git a/plinth/modules/firewall/urls.py b/plinth/modules/firewall/urls.py index d21372091..5f7eaaec7 100644 --- a/plinth/modules/firewall/urls.py +++ b/plinth/modules/firewall/urls.py @@ -3,10 +3,10 @@ URLs for the Firewall module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/firewall/$', views.FirewallAppView.as_view(), name='index'), + re_path(r'^sys/firewall/$', views.FirewallAppView.as_view(), name='index'), ] diff --git a/plinth/modules/first_boot/urls.py b/plinth/modules/first_boot/urls.py index 88b1a21aa..bc8c4a987 100644 --- a/plinth/modules/first_boot/urls.py +++ b/plinth/modules/first_boot/urls.py @@ -3,15 +3,15 @@ URLs for the First Boot module """ -from django.conf.urls import url +from django.urls import re_path from stronghold.decorators import public from .views import CompleteView, WelcomeView urlpatterns = [ # Take care of the firstboot middleware when changing URLs - url(r'^firstboot/$', public(WelcomeView.as_view()), name='index'), - url(r'^firstboot/welcome/$', public(WelcomeView.as_view()), - name='welcome'), - url(r'^firstboot/complete/$', CompleteView.as_view(), name='complete'), + re_path(r'^firstboot/$', public(WelcomeView.as_view()), name='index'), + re_path(r'^firstboot/welcome/$', public(WelcomeView.as_view()), + name='welcome'), + re_path(r'^firstboot/complete/$', CompleteView.as_view(), name='complete'), ] diff --git a/plinth/modules/gitweb/urls.py b/plinth/modules/gitweb/urls.py index 4f2d959af..b7e36de7f 100644 --- a/plinth/modules/gitweb/urls.py +++ b/plinth/modules/gitweb/urls.py @@ -3,19 +3,19 @@ URLs for the Gitweb module. """ -from django.conf.urls import url +from django.urls import re_path from .views import CreateRepoView, EditRepoView, GitwebAppView, delete urlpatterns = [ - url(r'^apps/gitweb/$', GitwebAppView.as_view(), name='index'), - url(r'^apps/gitweb/create/$', CreateRepoView.as_view(), name='create'), - url( + re_path(r'^apps/gitweb/$', GitwebAppView.as_view(), name='index'), + re_path(r'^apps/gitweb/create/$', CreateRepoView.as_view(), name='create'), + re_path( r'^apps/gitweb/(?P[a-zA-Z0-9-._]+)/edit/$', EditRepoView.as_view(), name='edit', ), - url( + re_path( r'^apps/gitweb/(?P[a-zA-Z0-9-._]+)/delete/$', delete, name='delete', diff --git a/plinth/modules/help/urls.py b/plinth/modules/help/urls.py index 1a7d41a17..188cbf07d 100644 --- a/plinth/modules/help/urls.py +++ b/plinth/modules/help/urls.py @@ -3,26 +3,27 @@ URLs for the Help module """ -from django.conf.urls import url +from django.urls import re_path from plinth.utils import non_admin_view from . import views urlpatterns = [ - url(r'^help/$', non_admin_view(views.index), name='index'), - url(r'^help/about/$', non_admin_view(views.about), name='about'), - url(r'^help/feedback/$', non_admin_view(views.feedback), name='feedback'), - url(r'^help/support/$', non_admin_view(views.support), name='support'), - url(r'^help/contribute/$', non_admin_view(views.contribute), - name='contribute'), - url(r'^help/manual/$', non_admin_view(views.manual), name='manual'), - url(r'^help/manual/(?P\w*(-\w*)?)/$', non_admin_view(views.manual), - name='manual'), - url(r'^help/manual/(?P\w*(-\w*)?)/(?P[\w-]+)$', - non_admin_view(views.manual), name='manual-page'), - url(r'^help/manual-download/$', non_admin_view(views.download_manual), - name='download-manual'), - url(r'^help/status-log/$', non_admin_view(views.status_log), - name='status-log'), + re_path(r'^help/$', non_admin_view(views.index), name='index'), + re_path(r'^help/about/$', non_admin_view(views.about), name='about'), + re_path(r'^help/feedback/$', non_admin_view(views.feedback), + name='feedback'), + re_path(r'^help/support/$', non_admin_view(views.support), name='support'), + re_path(r'^help/contribute/$', non_admin_view(views.contribute), + name='contribute'), + re_path(r'^help/manual/$', non_admin_view(views.manual), name='manual'), + re_path(r'^help/manual/(?P\w*(-\w*)?)/$', + non_admin_view(views.manual), name='manual'), + re_path(r'^help/manual/(?P\w*(-\w*)?)/(?P[\w-]+)$', + non_admin_view(views.manual), name='manual-page'), + re_path(r'^help/manual-download/$', non_admin_view(views.download_manual), + name='download-manual'), + re_path(r'^help/status-log/$', non_admin_view(views.status_log), + name='status-log'), ] diff --git a/plinth/modules/i2p/urls.py b/plinth/modules/i2p/urls.py index c51cde644..e43f0f28e 100644 --- a/plinth/modules/i2p/urls.py +++ b/plinth/modules/i2p/urls.py @@ -3,8 +3,10 @@ URLs for the I2P module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.i2p import views -urlpatterns = [url(r'^apps/i2p/$', views.I2PAppView.as_view(), name='index')] +urlpatterns = [ + re_path(r'^apps/i2p/$', views.I2PAppView.as_view(), name='index') +] diff --git a/plinth/modules/ikiwiki/urls.py b/plinth/modules/ikiwiki/urls.py index 95ea75236..efe0de15d 100644 --- a/plinth/modules/ikiwiki/urls.py +++ b/plinth/modules/ikiwiki/urls.py @@ -3,12 +3,13 @@ URLs for the ikiwiki module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^apps/ikiwiki/$', views.IkiwikiAppView.as_view(), name='index'), - url(r'^apps/ikiwiki/(?P.+)/delete/$', views.delete, name='delete'), - url(r'^apps/ikiwiki/create/$', views.create, name='create'), + re_path(r'^apps/ikiwiki/$', views.IkiwikiAppView.as_view(), name='index'), + re_path(r'^apps/ikiwiki/(?P.+)/delete/$', views.delete, + name='delete'), + re_path(r'^apps/ikiwiki/create/$', views.create, name='create'), ] diff --git a/plinth/modules/infinoted/urls.py b/plinth/modules/infinoted/urls.py index 5f67998d3..117896f59 100644 --- a/plinth/modules/infinoted/urls.py +++ b/plinth/modules/infinoted/urls.py @@ -3,11 +3,11 @@ URLs for the infinoted module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/infinoted/$', AppView.as_view(app_id='infinoted'), - name='index'), + re_path(r'^apps/infinoted/$', AppView.as_view(app_id='infinoted'), + name='index'), ] diff --git a/plinth/modules/jsxc/urls.py b/plinth/modules/jsxc/urls.py index 97bdd3fe6..e9667d2aa 100644 --- a/plinth/modules/jsxc/urls.py +++ b/plinth/modules/jsxc/urls.py @@ -3,7 +3,7 @@ URLs for the JSXC module """ -from django.conf.urls import url +from django.urls import re_path from stronghold.decorators import public from plinth.views import AppView @@ -11,6 +11,6 @@ from plinth.views import AppView from .views import JsxcView urlpatterns = [ - url(r'^apps/jsxc/$', AppView.as_view(app_id='jsxc'), name='index'), - url(r'^apps/jsxc/jsxc/$', public(JsxcView.as_view()), name='jsxc') + re_path(r'^apps/jsxc/$', AppView.as_view(app_id='jsxc'), name='index'), + re_path(r'^apps/jsxc/jsxc/$', public(JsxcView.as_view()), name='jsxc') ] diff --git a/plinth/modules/letsencrypt/urls.py b/plinth/modules/letsencrypt/urls.py index 35293a278..1934ff167 100644 --- a/plinth/modules/letsencrypt/urls.py +++ b/plinth/modules/letsencrypt/urls.py @@ -3,18 +3,18 @@ URLs for the Let's Encrypt module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/letsencrypt/$', views.index, name='index'), - url(r'^sys/letsencrypt/obtain/(?P[^/]+)/$', views.obtain, - name='obtain'), - url(r'^sys/letsencrypt/re-obtain/(?P[^/]+)/$', views.reobtain, - name='re-obtain'), - url(r'^sys/letsencrypt/revoke/(?P[^/]+)/$', views.revoke, - name='revoke'), - url(r'^sys/letsencrypt/delete/(?P[^/]+)/$', views.delete, - name='delete'), + re_path(r'^sys/letsencrypt/$', views.index, name='index'), + re_path(r'^sys/letsencrypt/obtain/(?P[^/]+)/$', views.obtain, + name='obtain'), + re_path(r'^sys/letsencrypt/re-obtain/(?P[^/]+)/$', views.reobtain, + name='re-obtain'), + re_path(r'^sys/letsencrypt/revoke/(?P[^/]+)/$', views.revoke, + name='revoke'), + re_path(r'^sys/letsencrypt/delete/(?P[^/]+)/$', views.delete, + name='delete'), ] diff --git a/plinth/modules/matrixsynapse/urls.py b/plinth/modules/matrixsynapse/urls.py index 12d55ac22..14a37c5b8 100644 --- a/plinth/modules/matrixsynapse/urls.py +++ b/plinth/modules/matrixsynapse/urls.py @@ -3,12 +3,12 @@ URLs for the matrix-synapse module. """ -from django.conf.urls import url +from django.urls import re_path from .views import MatrixSynapseAppView, SetupView urlpatterns = [ - url(r'^apps/matrixsynapse/setup/$', SetupView.as_view(), name='setup'), - url(r'^apps/matrixsynapse/$', MatrixSynapseAppView.as_view(), - name='index'), + re_path(r'^apps/matrixsynapse/setup/$', SetupView.as_view(), name='setup'), + re_path(r'^apps/matrixsynapse/$', MatrixSynapseAppView.as_view(), + name='index'), ] diff --git a/plinth/modules/mediawiki/urls.py b/plinth/modules/mediawiki/urls.py index 2a3196c62..a1cd386c4 100644 --- a/plinth/modules/mediawiki/urls.py +++ b/plinth/modules/mediawiki/urls.py @@ -3,10 +3,10 @@ URLs for the mediawiki module. """ -from django.conf.urls import url +from django.urls import re_path from .views import MediaWikiAppView urlpatterns = [ - url(r'^apps/mediawiki/$', MediaWikiAppView.as_view(), name='index'), + re_path(r'^apps/mediawiki/$', MediaWikiAppView.as_view(), name='index'), ] diff --git a/plinth/modules/minetest/urls.py b/plinth/modules/minetest/urls.py index 41bbf8484..1e057eee2 100644 --- a/plinth/modules/minetest/urls.py +++ b/plinth/modules/minetest/urls.py @@ -3,10 +3,10 @@ URLs for the minetest module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.minetest.views import MinetestAppView urlpatterns = [ - url(r'^apps/minetest/$', MinetestAppView.as_view(), name='index'), + re_path(r'^apps/minetest/$', MinetestAppView.as_view(), name='index'), ] diff --git a/plinth/modules/minidlna/urls.py b/plinth/modules/minidlna/urls.py index 48c5dc106..952852b91 100644 --- a/plinth/modules/minidlna/urls.py +++ b/plinth/modules/minidlna/urls.py @@ -3,10 +3,10 @@ URLs for the minidlna Server module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.minidlna.views import MiniDLNAAppView urlpatterns = [ - url(r'^apps/minidlna/$', MiniDLNAAppView.as_view(), name='index'), + re_path(r'^apps/minidlna/$', MiniDLNAAppView.as_view(), name='index'), ] diff --git a/plinth/modules/mldonkey/urls.py b/plinth/modules/mldonkey/urls.py index edb5ec743..f96e85994 100644 --- a/plinth/modules/mldonkey/urls.py +++ b/plinth/modules/mldonkey/urls.py @@ -3,10 +3,11 @@ URLs for the mldonkey module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/mldonkey/$', AppView.as_view(app_id='mldonkey'), name='index') + re_path(r'^apps/mldonkey/$', AppView.as_view(app_id='mldonkey'), + name='index') ] diff --git a/plinth/modules/monkeysphere/urls.py b/plinth/modules/monkeysphere/urls.py index badf1b99e..68e1cb215 100644 --- a/plinth/modules/monkeysphere/urls.py +++ b/plinth/modules/monkeysphere/urls.py @@ -3,17 +3,17 @@ URLs for the monkeysphere module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/monkeysphere/$', views.index, name='index'), - url(r'^sys/monkeysphere/(?P[0-9A-Za-z:+/]+)/import/$', - views.import_key, name='import'), - url(r'^sys/monkeysphere/(?P[0-9A-Fa-f]+)/details/$', - views.details, name='details'), - url(r'^sys/monkeysphere/(?P[0-9A-Fa-f]+)/publish/$', - views.publish, name='publish'), - url(r'^sys/monkeysphere/cancel/$', views.cancel, name='cancel'), + re_path(r'^sys/monkeysphere/$', views.index, name='index'), + re_path(r'^sys/monkeysphere/(?P[0-9A-Za-z:+/]+)/import/$', + views.import_key, name='import'), + re_path(r'^sys/monkeysphere/(?P[0-9A-Fa-f]+)/details/$', + views.details, name='details'), + re_path(r'^sys/monkeysphere/(?P[0-9A-Fa-f]+)/publish/$', + views.publish, name='publish'), + re_path(r'^sys/monkeysphere/cancel/$', views.cancel, name='cancel'), ] diff --git a/plinth/modules/mumble/urls.py b/plinth/modules/mumble/urls.py index 5de76f4ae..67e6ccbdb 100644 --- a/plinth/modules/mumble/urls.py +++ b/plinth/modules/mumble/urls.py @@ -3,10 +3,10 @@ URLs for the Mumble module """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.mumble.views import MumbleAppView urlpatterns = [ - url(r'^apps/mumble/$', MumbleAppView.as_view(), name='index'), + re_path(r'^apps/mumble/$', MumbleAppView.as_view(), name='index'), ] diff --git a/plinth/modules/names/urls.py b/plinth/modules/names/urls.py index 713accd75..bc2b936ee 100644 --- a/plinth/modules/names/urls.py +++ b/plinth/modules/names/urls.py @@ -3,10 +3,10 @@ URLs for the name services module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/names/$', views.index, name='index'), + re_path(r'^sys/names/$', views.index, name='index'), ] diff --git a/plinth/modules/networks/urls.py b/plinth/modules/networks/urls.py index db6629d66..e185181e5 100644 --- a/plinth/modules/networks/urls.py +++ b/plinth/modules/networks/urls.py @@ -3,43 +3,47 @@ URLs for the Network module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/networks/$', views.index, name='index'), - url(r'^sys/networks/(?P[\w.@+-]+)/show/$', views.show, name='show'), - url(r'^sys/networks/(?P[\w.@+-]+)/edit/$', views.edit, name='edit'), - url(r'^sys/networks/(?P[\w.@+-]+)/activate/$', views.activate, - name='activate'), - url(r'^sys/networks/(?P[\w.@+-]+)/deactivate/$', views.deactivate, - name='deactivate'), - url(r'^sys/networks/scan/$', views.scan, name='scan'), - url(r'^sys/networks/add/$', views.add, name='add'), - url(r'^sys/networks/add/generic/$', views.add_generic, name='add_generic'), - url(r'^sys/networks/add/ethernet/$', views.add_ethernet, - name='add_ethernet'), - url(r'^sys/networks/add/pppoe/$', views.add_pppoe, name='add_pppoe'), - url( + re_path(r'^sys/networks/$', views.index, name='index'), + re_path(r'^sys/networks/(?P[\w.@+-]+)/show/$', views.show, + name='show'), + re_path(r'^sys/networks/(?P[\w.@+-]+)/edit/$', views.edit, + name='edit'), + re_path(r'^sys/networks/(?P[\w.@+-]+)/activate/$', views.activate, + name='activate'), + re_path(r'^sys/networks/(?P[\w.@+-]+)/deactivate/$', + views.deactivate, name='deactivate'), + re_path(r'^sys/networks/scan/$', views.scan, name='scan'), + re_path(r'^sys/networks/add/$', views.add, name='add'), + re_path(r'^sys/networks/add/generic/$', views.add_generic, + name='add_generic'), + re_path(r'^sys/networks/add/ethernet/$', views.add_ethernet, + name='add_ethernet'), + re_path(r'^sys/networks/add/pppoe/$', views.add_pppoe, name='add_pppoe'), + re_path( r'^sys/networks/add/wifi/(?:(?P[^/]+)/' r'(?P[^/]+)/)?$', views.add_wifi, name='add_wifi'), - url(r'^sys/networks/(?P[\w.@+-]+)/delete/$', views.delete, - name='delete'), - url(r'^sys/networks/router-configuration/$', - views.RouterConfigurationView.as_view(), name='router-configuration'), - url(r'^sys/networks/firstboot/router-configuration/$', - views.RouterConfigurationFirstBootView.as_view(), - name='router-configuration-first-boot'), - url(r'^sys/networks/internet-connection-type/$', - views.InternetConnectionTypeView.as_view(), - name='internet-connection-type'), - url(r'^sys/networks/firstboot/internet-connection-type/$', - views.InternetConnectionTypeFirstBootView.as_view(), - name='internet-connection-type-first-boot'), - url(r'^sys/networks/network-topology/$', - views.NetworkTopologyView.as_view(), name='network-topology'), - url(r'^sys/networks/firstboot/network-topology-first-boot/$', - views.NetworkTopologyFirstBootView.as_view(), - name='network-topology-first-boot'), + re_path(r'^sys/networks/(?P[\w.@+-]+)/delete/$', views.delete, + name='delete'), + re_path(r'^sys/networks/router-configuration/$', + views.RouterConfigurationView.as_view(), + name='router-configuration'), + re_path(r'^sys/networks/firstboot/router-configuration/$', + views.RouterConfigurationFirstBootView.as_view(), + name='router-configuration-first-boot'), + re_path(r'^sys/networks/internet-connection-type/$', + views.InternetConnectionTypeView.as_view(), + name='internet-connection-type'), + re_path(r'^sys/networks/firstboot/internet-connection-type/$', + views.InternetConnectionTypeFirstBootView.as_view(), + name='internet-connection-type-first-boot'), + re_path(r'^sys/networks/network-topology/$', + views.NetworkTopologyView.as_view(), name='network-topology'), + re_path(r'^sys/networks/firstboot/network-topology-first-boot/$', + views.NetworkTopologyFirstBootView.as_view(), + name='network-topology-first-boot'), ] diff --git a/plinth/modules/openvpn/urls.py b/plinth/modules/openvpn/urls.py index 4cdc881d1..77b24d3e1 100644 --- a/plinth/modules/openvpn/urls.py +++ b/plinth/modules/openvpn/urls.py @@ -3,16 +3,16 @@ URLs for the OpenVPN module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.utils import user_group_view from . import views urlpatterns = [ - url(r'^apps/openvpn/$', views.OpenVPNAppView.as_view(), name='index'), - url(r'^apps/openvpn/setup/$', views.setup, name='setup'), - url(r'^apps/openvpn/ecc/$', views.ecc, name='ecc'), - url(r'^apps/openvpn/profile/$', user_group_view(views.profile, 'vpn'), - name='profile'), + re_path(r'^apps/openvpn/$', views.OpenVPNAppView.as_view(), name='index'), + re_path(r'^apps/openvpn/setup/$', views.setup, name='setup'), + re_path(r'^apps/openvpn/ecc/$', views.ecc, name='ecc'), + re_path(r'^apps/openvpn/profile/$', user_group_view(views.profile, 'vpn'), + name='profile'), ] diff --git a/plinth/modules/pagekite/urls.py b/plinth/modules/pagekite/urls.py index fa60feaf4..1caa42966 100644 --- a/plinth/modules/pagekite/urls.py +++ b/plinth/modules/pagekite/urls.py @@ -3,14 +3,14 @@ URLs for the PageKite module """ -from django.conf.urls import url +from django.urls import re_path from .views import AddCustomServiceView, ConfigurationView, DeleteServiceView urlpatterns = [ - url(r'^sys/pagekite/$', ConfigurationView.as_view(), name='index'), - url(r'^sys/pagekite/services/custom/add/$', AddCustomServiceView.as_view(), - name='add-custom-service'), - url(r'^sys/pagekite/services/custom/delete/$', DeleteServiceView.as_view(), - name='delete-custom-service'), + re_path(r'^sys/pagekite/$', ConfigurationView.as_view(), name='index'), + re_path(r'^sys/pagekite/services/custom/add/$', + AddCustomServiceView.as_view(), name='add-custom-service'), + re_path(r'^sys/pagekite/services/custom/delete/$', + DeleteServiceView.as_view(), name='delete-custom-service'), ] diff --git a/plinth/modules/performance/urls.py b/plinth/modules/performance/urls.py index 06920625d..2dd41bf10 100644 --- a/plinth/modules/performance/urls.py +++ b/plinth/modules/performance/urls.py @@ -3,11 +3,11 @@ FreedomBox app for System Monitoring (cockpit-pcp) in ‘System’. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^sys/performance/$', AppView.as_view(app_id='performance'), - name='index'), + re_path(r'^sys/performance/$', AppView.as_view(app_id='performance'), + name='index'), ] diff --git a/plinth/modules/power/urls.py b/plinth/modules/power/urls.py index 772df67ad..fbd800877 100644 --- a/plinth/modules/power/urls.py +++ b/plinth/modules/power/urls.py @@ -3,12 +3,12 @@ URLs for the power module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/power/$', views.index, name='index'), - url(r'^sys/power/restart$', views.restart, name='restart'), - url(r'^sys/power/shutdown$', views.shutdown, name='shutdown'), + re_path(r'^sys/power/$', views.index, name='index'), + re_path(r'^sys/power/restart$', views.restart, name='restart'), + re_path(r'^sys/power/shutdown$', views.shutdown, name='shutdown'), ] diff --git a/plinth/modules/privoxy/urls.py b/plinth/modules/privoxy/urls.py index eb908a8c4..137aeab8d 100644 --- a/plinth/modules/privoxy/urls.py +++ b/plinth/modules/privoxy/urls.py @@ -3,10 +3,11 @@ URLs for the Privoxy module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/privoxy/$', AppView.as_view(app_id='privoxy'), name='index'), + re_path(r'^apps/privoxy/$', AppView.as_view(app_id='privoxy'), + name='index'), ] diff --git a/plinth/modules/quassel/urls.py b/plinth/modules/quassel/urls.py index b3536433d..844037337 100644 --- a/plinth/modules/quassel/urls.py +++ b/plinth/modules/quassel/urls.py @@ -3,10 +3,10 @@ URLs for the quassel module. """ -from django.conf.urls import url +from django.urls import re_path from .views import QuasselAppView urlpatterns = [ - url(r'^apps/quassel/$', QuasselAppView.as_view(), name='index'), + re_path(r'^apps/quassel/$', QuasselAppView.as_view(), name='index'), ] diff --git a/plinth/modules/radicale/urls.py b/plinth/modules/radicale/urls.py index 397c5d63f..8570da95e 100644 --- a/plinth/modules/radicale/urls.py +++ b/plinth/modules/radicale/urls.py @@ -3,10 +3,10 @@ URLs for the radicale module. """ -from django.conf.urls import url +from django.urls import re_path from .views import RadicaleAppView urlpatterns = [ - url(r'^apps/radicale/$', RadicaleAppView.as_view(), name='index'), + re_path(r'^apps/radicale/$', RadicaleAppView.as_view(), name='index'), ] diff --git a/plinth/modules/roundcube/urls.py b/plinth/modules/roundcube/urls.py index 5c7a79c76..bf575c0a1 100644 --- a/plinth/modules/roundcube/urls.py +++ b/plinth/modules/roundcube/urls.py @@ -3,11 +3,11 @@ URLs for the Roundcube module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/roundcube/$', AppView.as_view(app_id='roundcube'), - name='index') + re_path(r'^apps/roundcube/$', AppView.as_view(app_id='roundcube'), + name='index') ] diff --git a/plinth/modules/samba/urls.py b/plinth/modules/samba/urls.py index 7df7a7630..e46e5c108 100644 --- a/plinth/modules/samba/urls.py +++ b/plinth/modules/samba/urls.py @@ -3,12 +3,12 @@ URLs for the samba module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^apps/samba/$', views.SambaAppView.as_view(), name='index'), - url(r'^apps/samba/share/(?P[A-Za-z0-9%_.\-~]+)/$', - views.share, name='share') + re_path(r'^apps/samba/$', views.SambaAppView.as_view(), name='index'), + re_path(r'^apps/samba/share/(?P[A-Za-z0-9%_.\-~]+)/$', + views.share, name='share') ] diff --git a/plinth/modules/searx/urls.py b/plinth/modules/searx/urls.py index afc4c8701..2efeba441 100644 --- a/plinth/modules/searx/urls.py +++ b/plinth/modules/searx/urls.py @@ -3,10 +3,10 @@ URLs for the Searx module. """ -from django.conf.urls import url +from django.urls import re_path from .views import SearxAppView urlpatterns = [ - url(r'^apps/searx/$', SearxAppView.as_view(), name='index'), + re_path(r'^apps/searx/$', SearxAppView.as_view(), name='index'), ] diff --git a/plinth/modules/security/urls.py b/plinth/modules/security/urls.py index dea22a8a6..24665b981 100644 --- a/plinth/modules/security/urls.py +++ b/plinth/modules/security/urls.py @@ -3,11 +3,11 @@ URLs for the security module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/security/$', views.index, name='index'), - url(r'^sys/security/report$', views.report, name='report'), + re_path(r'^sys/security/$', views.index, name='index'), + re_path(r'^sys/security/report$', views.report, name='report'), ] diff --git a/plinth/modules/shaarli/urls.py b/plinth/modules/shaarli/urls.py index 0800f18cb..4aa82a258 100644 --- a/plinth/modules/shaarli/urls.py +++ b/plinth/modules/shaarli/urls.py @@ -3,10 +3,11 @@ URLs for the Shaarli module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/shaarli/$', AppView.as_view(app_id='shaarli'), name='index') + re_path(r'^apps/shaarli/$', AppView.as_view(app_id='shaarli'), + name='index') ] diff --git a/plinth/modules/shadowsocks/urls.py b/plinth/modules/shadowsocks/urls.py index a05a303d9..bc776c74a 100644 --- a/plinth/modules/shadowsocks/urls.py +++ b/plinth/modules/shadowsocks/urls.py @@ -3,10 +3,11 @@ URLs for the Shadowsocks module. """ -from django.conf.urls import url +from django.urls import re_path from .views import ShadowsocksAppView urlpatterns = [ - url(r'^apps/shadowsocks/$', ShadowsocksAppView.as_view(), name='index'), + re_path(r'^apps/shadowsocks/$', ShadowsocksAppView.as_view(), + name='index'), ] diff --git a/plinth/modules/sharing/urls.py b/plinth/modules/sharing/urls.py index 54feb8248..9c1338054 100644 --- a/plinth/modules/sharing/urls.py +++ b/plinth/modules/sharing/urls.py @@ -3,14 +3,15 @@ URLs for the sharing app. """ -from django.conf.urls import url +from django.urls import re_path from .views import AddShareView, EditShareView, IndexView, remove urlpatterns = [ - url(r'^apps/sharing/$', IndexView.as_view(), name='index'), - url(r'^apps/sharing/add/$', AddShareView.as_view(), name='add'), - url(r'^apps/sharing/(?P[a-z0-9]+)/edit/$', EditShareView.as_view(), - name='edit'), - url(r'^apps/sharing/(?P[a-z0-9]+)/remove/$', remove, name='remove'), + re_path(r'^apps/sharing/$', IndexView.as_view(), name='index'), + re_path(r'^apps/sharing/add/$', AddShareView.as_view(), name='add'), + re_path(r'^apps/sharing/(?P[a-z0-9]+)/edit/$', + EditShareView.as_view(), name='edit'), + re_path(r'^apps/sharing/(?P[a-z0-9]+)/remove/$', remove, + name='remove'), ] diff --git a/plinth/modules/snapshot/urls.py b/plinth/modules/snapshot/urls.py index e1f4973ec..0eb25c744 100644 --- a/plinth/modules/snapshot/urls.py +++ b/plinth/modules/snapshot/urls.py @@ -3,15 +3,15 @@ URLs for the snapshot module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/snapshot/$', views.index, name='index'), - url(r'^sys/snapshot/manage/$', views.manage, name='manage'), - url(r'^sys/snapshot/selected/delete$', views.delete_selected, - name='delete-selected'), - url(r'^sys/snapshot/(?P\d+)/rollback$', views.rollback, - name='rollback'), + re_path(r'^sys/snapshot/$', views.index, name='index'), + re_path(r'^sys/snapshot/manage/$', views.manage, name='manage'), + re_path(r'^sys/snapshot/selected/delete$', views.delete_selected, + name='delete-selected'), + re_path(r'^sys/snapshot/(?P\d+)/rollback$', views.rollback, + name='rollback'), ] diff --git a/plinth/modules/ssh/urls.py b/plinth/modules/ssh/urls.py index 91c0df7c3..49032a6bf 100644 --- a/plinth/modules/ssh/urls.py +++ b/plinth/modules/ssh/urls.py @@ -3,10 +3,10 @@ URLs for the Secure Shell Server module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.ssh.views import SshAppView urlpatterns = [ - url(r'^sys/ssh/$', SshAppView.as_view(), name='index'), + re_path(r'^sys/ssh/$', SshAppView.as_view(), name='index'), ] diff --git a/plinth/modules/sso/urls.py b/plinth/modules/sso/urls.py index 6a9364795..fda36b82f 100644 --- a/plinth/modules/sso/urls.py +++ b/plinth/modules/sso/urls.py @@ -3,7 +3,7 @@ URLs for the Single Sign On module. """ -from django.conf.urls import url +from django.urls import re_path from stronghold.decorators import public from plinth.utils import non_admin_view @@ -11,8 +11,8 @@ from plinth.utils import non_admin_view from .views import SSOLoginView, refresh urlpatterns = [ - url(r'^accounts/sso/login/$', public(SSOLoginView.as_view()), - name='sso-login'), - url(r'^accounts/sso/refresh/$', non_admin_view(refresh), - name='sso-refresh'), + re_path(r'^accounts/sso/login/$', public(SSOLoginView.as_view()), + name='sso-login'), + re_path(r'^accounts/sso/refresh/$', non_admin_view(refresh), + name='sso-refresh'), ] diff --git a/plinth/modules/storage/urls.py b/plinth/modules/storage/urls.py index 8cc25e8f5..a572ac114 100644 --- a/plinth/modules/storage/urls.py +++ b/plinth/modules/storage/urls.py @@ -3,13 +3,13 @@ URLs for the disks module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/storage/$', views.StorageAppView.as_view(), name='index'), - url(r'^sys/storage/expand$', views.expand, name='expand'), - url(r'^sys/storage/eject/(?P[A-Za-z0-9%_.\-~]+)/$', - views.eject, name='eject') + re_path(r'^sys/storage/$', views.StorageAppView.as_view(), name='index'), + re_path(r'^sys/storage/expand$', views.expand, name='expand'), + re_path(r'^sys/storage/eject/(?P[A-Za-z0-9%_.\-~]+)/$', + views.eject, name='eject') ] diff --git a/plinth/modules/syncthing/urls.py b/plinth/modules/syncthing/urls.py index 1f1a9f05b..178a244c7 100644 --- a/plinth/modules/syncthing/urls.py +++ b/plinth/modules/syncthing/urls.py @@ -3,11 +3,11 @@ URLs for the Syncthing module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/syncthing/$', AppView.as_view(app_id='syncthing'), - name='index') + re_path(r'^apps/syncthing/$', AppView.as_view(app_id='syncthing'), + name='index') ] diff --git a/plinth/modules/tahoe/urls.py b/plinth/modules/tahoe/urls.py index da803ac8f..e076a5a95 100644 --- a/plinth/modules/tahoe/urls.py +++ b/plinth/modules/tahoe/urls.py @@ -3,16 +3,16 @@ URLs for the Tahoe-LAFS module. """ -from django.conf.urls import url +from django.urls import re_path from . import views from .views import TahoeAppView, TahoeSetupView urlpatterns = [ - url(r'^apps/tahoe/setup/$', TahoeSetupView.as_view(), name='setup'), - url(r'^apps/tahoe/add_introducer/$', views.add_introducer, - name='add-introducer'), - url(r'^apps/tahoe/remove_introducer/(?P[0-9a-zA-Z_]+)/$', - views.remove_introducer, name='remove-introducer'), - url(r'^apps/tahoe/$', TahoeAppView.as_view(), name='index') + re_path(r'^apps/tahoe/setup/$', TahoeSetupView.as_view(), name='setup'), + re_path(r'^apps/tahoe/add_introducer/$', views.add_introducer, + name='add-introducer'), + re_path(r'^apps/tahoe/remove_introducer/(?P[0-9a-zA-Z_]+)/$', + views.remove_introducer, name='remove-introducer'), + re_path(r'^apps/tahoe/$', TahoeAppView.as_view(), name='index') ] diff --git a/plinth/modules/tor/urls.py b/plinth/modules/tor/urls.py index 0879755f5..4b7c31116 100644 --- a/plinth/modules/tor/urls.py +++ b/plinth/modules/tor/urls.py @@ -3,10 +3,10 @@ URLs for the Tor module. """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^apps/tor/$', views.index, name='index'), + re_path(r'^apps/tor/$', views.index, name='index'), ] diff --git a/plinth/modules/transmission/urls.py b/plinth/modules/transmission/urls.py index 31784e40e..31ded21e8 100644 --- a/plinth/modules/transmission/urls.py +++ b/plinth/modules/transmission/urls.py @@ -3,10 +3,11 @@ URLs for the Transmission module. """ -from django.conf.urls import url +from django.urls import re_path from .views import TransmissionAppView urlpatterns = [ - url(r'^apps/transmission/$', TransmissionAppView.as_view(), name='index'), + re_path(r'^apps/transmission/$', TransmissionAppView.as_view(), + name='index'), ] diff --git a/plinth/modules/ttrss/urls.py b/plinth/modules/ttrss/urls.py index 19bee29ff..310722a56 100644 --- a/plinth/modules/ttrss/urls.py +++ b/plinth/modules/ttrss/urls.py @@ -3,10 +3,10 @@ URLs for the Tiny Tiny RSS module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.views import AppView urlpatterns = [ - url(r'^apps/ttrss/$', AppView.as_view(app_id='ttrss'), name='index') + re_path(r'^apps/ttrss/$', AppView.as_view(app_id='ttrss'), name='index') ] diff --git a/plinth/modules/upgrades/urls.py b/plinth/modules/upgrades/urls.py index e20c2b147..2e88747e0 100644 --- a/plinth/modules/upgrades/urls.py +++ b/plinth/modules/upgrades/urls.py @@ -3,21 +3,22 @@ URLs for the upgrades module """ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^sys/upgrades/$', views.UpgradesConfigurationView.as_view(), - name='index'), - url(r'^sys/upgrades/activate-backports/$', views.activate_backports, - name='activate-backports'), - url(r'^sys/upgrades/firstboot/backports/$', - views.BackportsFirstbootView.as_view(), name='backports-firstboot'), - url(r'^sys/upgrades/firstboot/update/$', - views.UpdateFirstbootView.as_view(), name='update-firstboot'), - url(r'^sys/upgrades/firstboot/update/progress/$', - views.UpdateFirstbootProgressView.as_view(), - name='update-firstboot-progress'), - url(r'^sys/upgrades/upgrade/$', views.upgrade, name='upgrade'), + re_path(r'^sys/upgrades/$', views.UpgradesConfigurationView.as_view(), + name='index'), + re_path(r'^sys/upgrades/activate-backports/$', views.activate_backports, + name='activate-backports'), + re_path(r'^sys/upgrades/firstboot/backports/$', + views.BackportsFirstbootView.as_view(), + name='backports-firstboot'), + re_path(r'^sys/upgrades/firstboot/update/$', + views.UpdateFirstbootView.as_view(), name='update-firstboot'), + re_path(r'^sys/upgrades/firstboot/update/progress/$', + views.UpdateFirstbootProgressView.as_view(), + name='update-firstboot-progress'), + re_path(r'^sys/upgrades/upgrade/$', views.upgrade, name='upgrade'), ] diff --git a/plinth/modules/users/urls.py b/plinth/modules/users/urls.py index 935a2fc2e..5d6fb84e2 100644 --- a/plinth/modules/users/urls.py +++ b/plinth/modules/users/urls.py @@ -4,8 +4,7 @@ URLs for the Users module """ from axes.decorators import axes_dispatch -from django.conf.urls import url -from django.urls import reverse_lazy +from django.urls import re_path, reverse_lazy from stronghold.decorators import public from plinth.modules.sso.views import SSOLoginView, SSOLogoutView @@ -14,24 +13,24 @@ from plinth.utils import non_admin_view from . import views urlpatterns = [ - url(r'^sys/users/$', views.UserList.as_view(), name='index'), - url(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'), - url(r'^sys/users/(?P[\w.@+-]+)/edit/$', - non_admin_view(views.UserUpdate.as_view()), name='edit'), - url(r'^sys/users/(?P[\w.@+-]+)/delete/$', views.UserDelete.as_view(), - name='delete'), - url(r'^sys/users/(?P[\w.@+-]+)/change_password/$', - non_admin_view(views.UserChangePassword.as_view()), - name='change_password'), + re_path(r'^sys/users/$', views.UserList.as_view(), name='index'), + re_path(r'^sys/users/create/$', views.UserCreate.as_view(), name='create'), + re_path(r'^sys/users/(?P[\w.@+-]+)/edit/$', + non_admin_view(views.UserUpdate.as_view()), name='edit'), + re_path(r'^sys/users/(?P[\w.@+-]+)/delete/$', + views.UserDelete.as_view(), name='delete'), + re_path(r'^sys/users/(?P[\w.@+-]+)/change_password/$', + non_admin_view(views.UserChangePassword.as_view()), + name='change_password'), # Authnz is handled by SSO # XXX: Use axes authentication backend and middleware instead of # axes_dispatch after axes 5.x becomes available in Debian stable. - url(r'^accounts/login/$', public(axes_dispatch(SSOLoginView.as_view())), - name='login'), - url(r'^accounts/logout/$', non_admin_view(SSOLogoutView.as_view()), - {'next_page': reverse_lazy('index')}, name='logout'), - url(r'^users/firstboot/$', public(views.FirstBootView.as_view()), - name='firstboot'), + re_path(r'^accounts/login/$', + public(axes_dispatch(SSOLoginView.as_view())), name='login'), + re_path(r'^accounts/logout/$', non_admin_view(SSOLogoutView.as_view()), + {'next_page': reverse_lazy('index')}, name='logout'), + re_path(r'^users/firstboot/$', public(views.FirstBootView.as_view()), + name='firstboot'), ] diff --git a/plinth/modules/wireguard/urls.py b/plinth/modules/wireguard/urls.py index 8c3734e3f..d0dcc6bbe 100644 --- a/plinth/modules/wireguard/urls.py +++ b/plinth/modules/wireguard/urls.py @@ -3,26 +3,26 @@ URLs for the wireguard module. """ -from django.conf.urls import url +from django.urls import re_path from plinth.modules.wireguard import views urlpatterns = [ - url(r'^apps/wireguard/$', views.WireguardView.as_view(), name='index'), - url(r'^apps/wireguard/client/add/$', views.AddClientView.as_view(), - name='add-client'), - url(r'^apps/wireguard/client/(?P[^/]+)/show/$', - views.ShowClientView.as_view(), name='show-client'), - url(r'^apps/wireguard/client/(?P[^/]+)/edit/$', - views.EditClientView.as_view(), name='edit-client'), - url(r'^apps/wireguard/client/(?P[^/]+)/delete/$', - views.DeleteClientView.as_view(), name='delete-client'), - url(r'^apps/wireguard/server/add/$', views.AddServerView.as_view(), - name='add-server'), - url(r'^apps/wireguard/server/(?Pwg[0-9]+)/show/$', - views.ShowServerView.as_view(), name='show-server'), - url(r'^apps/wireguard/server/(?Pwg[0-9]+)/edit/$', - views.EditServerView.as_view(), name='edit-server'), - url(r'^apps/wireguard/server/(?Pwg[0-9]+)/delete/$', - views.DeleteServerView.as_view(), name='delete-server'), + re_path(r'^apps/wireguard/$', views.WireguardView.as_view(), name='index'), + re_path(r'^apps/wireguard/client/add/$', views.AddClientView.as_view(), + name='add-client'), + re_path(r'^apps/wireguard/client/(?P[^/]+)/show/$', + views.ShowClientView.as_view(), name='show-client'), + re_path(r'^apps/wireguard/client/(?P[^/]+)/edit/$', + views.EditClientView.as_view(), name='edit-client'), + re_path(r'^apps/wireguard/client/(?P[^/]+)/delete/$', + views.DeleteClientView.as_view(), name='delete-client'), + re_path(r'^apps/wireguard/server/add/$', views.AddServerView.as_view(), + name='add-server'), + re_path(r'^apps/wireguard/server/(?Pwg[0-9]+)/show/$', + views.ShowServerView.as_view(), name='show-server'), + re_path(r'^apps/wireguard/server/(?Pwg[0-9]+)/edit/$', + views.EditServerView.as_view(), name='edit-server'), + re_path(r'^apps/wireguard/server/(?Pwg[0-9]+)/delete/$', + views.DeleteServerView.as_view(), name='delete-server'), ] diff --git a/plinth/modules/wordpress/urls.py b/plinth/modules/wordpress/urls.py index f46b63908..d95d8b1df 100644 --- a/plinth/modules/wordpress/urls.py +++ b/plinth/modules/wordpress/urls.py @@ -3,11 +3,11 @@ URLs for the WordPress module. """ -from django.conf.urls import url +from django.urls import re_path from .views import WordPressAppView urlpatterns = [ - url(r'^apps/wordpress/$', WordPressAppView.as_view(app_id='wordpress'), - name='index'), + re_path(r'^apps/wordpress/$', WordPressAppView.as_view(app_id='wordpress'), + name='index'), ] diff --git a/plinth/modules/zoph/urls.py b/plinth/modules/zoph/urls.py index 15e49d964..3dd9f6a30 100644 --- a/plinth/modules/zoph/urls.py +++ b/plinth/modules/zoph/urls.py @@ -3,11 +3,11 @@ URLs for the Zoph module. """ -from django.conf.urls import url +from django.urls import re_path from .views import SetupView, ZophAppView urlpatterns = [ - url(r'^apps/zoph/setup/$', SetupView.as_view(), name='setup'), - url(r'^apps/zoph/$', ZophAppView.as_view(app_id='zoph'), name='index') + re_path(r'^apps/zoph/setup/$', SetupView.as_view(), name='setup'), + re_path(r'^apps/zoph/$', ZophAppView.as_view(app_id='zoph'), name='index') ] diff --git a/plinth/tests/data/urls.py b/plinth/tests/data/urls.py index 6a0c7c07c..88a377dcb 100644 --- a/plinth/tests/data/urls.py +++ b/plinth/tests/data/urls.py @@ -3,13 +3,14 @@ Django URL patterns for running tests. """ -from django.conf.urls import url +from django.urls import re_path from django.views.generic import TemplateView _test_view = TemplateView.as_view(template_name='index.html') urlpatterns = [ - url(r'^$', _test_view, name='index'), - url(r'^apps/$', _test_view, name='apps'), - url(r'^sys/$', _test_view, name='system'), - url(r'^test/(?P\d+)/(?P\d+)/(?P\d+)/$', _test_view, name='test'), + re_path(r'^$', _test_view, name='index'), + re_path(r'^apps/$', _test_view, name='apps'), + re_path(r'^sys/$', _test_view, name='system'), + re_path(r'^test/(?P\d+)/(?P\d+)/(?P\d+)/$', _test_view, + name='test'), ] diff --git a/plinth/urls.py b/plinth/urls.py index 5317ef32c..48ba8e336 100644 --- a/plinth/urls.py +++ b/plinth/urls.py @@ -3,7 +3,7 @@ Django URLconf file containing all urls """ from captcha import views as cviews -from django.conf.urls import url +from django.urls import re_path from stronghold.decorators import public from plinth.modules.sso.views import CaptchaLoginView @@ -11,27 +11,28 @@ from plinth.modules.sso.views import CaptchaLoginView from . import views urlpatterns = [ - url(r'^$', views.index, name='index'), - url(r'^language-selection/$', - public(views.LanguageSelectionView.as_view()), - name='language-selection'), - url(r'^apps/$', views.AppsIndexView.as_view(), name='apps'), - url(r'^sys/$', views.system_index, name='system'), + re_path(r'^$', views.index, name='index'), + re_path(r'^language-selection/$', + public(views.LanguageSelectionView.as_view()), + name='language-selection'), + re_path(r'^apps/$', views.AppsIndexView.as_view(), name='apps'), + re_path(r'^sys/$', views.system_index, name='system'), # captcha urls are public - url(r'^captcha/image/(?P\w+)/$', public(cviews.captcha_image), - name='captcha-image', kwargs={'scale': 1}), - url(r'^captcha/image/(?P\w+)@2/$', public(cviews.captcha_image), - name='captcha-image-2x', kwargs={'scale': 2}), - url(r'^captcha/audio/(?P\w+)/$', public(cviews.captcha_audio), - name='captcha-audio'), - url(r'^captcha/refresh/$', public(cviews.captcha_refresh), - name='captcha-refresh'), + re_path(r'^captcha/image/(?P\w+)/$', public(cviews.captcha_image), + name='captcha-image', kwargs={'scale': 1}), + re_path(r'^captcha/image/(?P\w+)@2/$', public(cviews.captcha_image), + name='captcha-image-2x', kwargs={'scale': 2}), + re_path(r'^captcha/audio/(?P\w+)/$', public(cviews.captcha_audio), + name='captcha-audio'), + re_path(r'^captcha/refresh/$', public(cviews.captcha_refresh), + name='captcha-refresh'), # locked url from django-axes - url(r'locked/$', public(CaptchaLoginView.as_view()), name='locked_out'), + re_path(r'locked/$', public(CaptchaLoginView.as_view()), + name='locked_out'), # Notifications - url(r'^notification/(?P[A-Za-z0-9-=]+)/dismiss/$', - views.notification_dismiss, name='notification_dismiss') + re_path(r'^notification/(?P[A-Za-z0-9-=]+)/dismiss/$', + views.notification_dismiss, name='notification_dismiss') ]