Sunil Mohan Adapa cd2b2f5f2c
*: 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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:47 -04:00

43 lines
2.1 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
URLs for the backups module.
"""
from django.urls import re_path
from .views import (AddRemoteRepositoryView, AddRepositoryView,
CreateArchiveView, DeleteArchiveView, DownloadArchiveView,
IndexView, RemoveRepositoryView, RestoreArchiveView,
RestoreFromUploadView, ScheduleView, UploadArchiveView,
VerifySshHostkeyView, mount_repository, umount_repository)
urlpatterns = [
re_path(r'^sys/backups/$', IndexView.as_view(), name='index'),
re_path(r'^sys/backups/(?P<uuid>[^/]+)/schedule/$', ScheduleView.as_view(),
name='schedule'),
re_path(r'^sys/backups/create/$', CreateArchiveView.as_view(),
name='create'),
re_path(r'^sys/backups/(?P<uuid>[^/]+)/download/(?P<name>[^/]+)/$',
DownloadArchiveView.as_view(), name='download'),
re_path(r'^sys/backups/(?P<uuid>[^/]+)/delete/(?P<name>[^/]+)/$',
DeleteArchiveView.as_view(), name='delete'),
re_path(r'^sys/backups/upload/$', UploadArchiveView.as_view(),
name='upload'),
re_path(r'^sys/backups/(?P<uuid>[^/]+)/restore-archive/(?P<name>[^/]+)/$',
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<uuid>[^/]+)/ssh-verify/$',
VerifySshHostkeyView.as_view(), name='verify-ssh-hostkey'),
re_path(r'^sys/backups/repositories/(?P<uuid>[^/]+)/delete/$',
RemoveRepositoryView.as_view(), name='repository-remove'),
re_path(r'^sys/backups/repositories/(?P<uuid>[^/]+)/mount/$',
mount_repository, name='repository-mount'),
re_path(r'^sys/backups/repositories/(?P<uuid>[^/]+)/umount/$',
umount_repository, name='repository-umount'),
]