From c2ced98da0d65bf2f104446d59b04c0c01828b4a Mon Sep 17 00:00:00 2001 From: Alexandre Rossi Date: Sat, 16 Dec 2023 17:30:35 +0100 Subject: [PATCH] django.conf.urls.url() was deprecated in Django 3, and removed in Django 4 --- webapp/graphite/account/urls.py | 10 +++---- webapp/graphite/browser/urls.py | 12 ++++----- webapp/graphite/composer/urls.py | 6 ++--- webapp/graphite/dashboard/urls.py | 44 +++++++++++++++---------------- webapp/graphite/events/urls.py | 8 +++--- webapp/graphite/functions/urls.py | 6 ++--- webapp/graphite/metrics/urls.py | 18 ++++++------- webapp/graphite/render/urls.py | 10 +++---- webapp/graphite/tags/urls.py | 18 ++++++------- webapp/graphite/urls.py | 34 ++++++++++++------------ webapp/graphite/version/urls.py | 4 +-- webapp/graphite/whitelist/urls.py | 8 +++--- 12 files changed, 89 insertions(+), 89 deletions(-) diff --git a/webapp/graphite/account/urls.py b/webapp/graphite/account/urls.py index efe298d9e..3973ead99 100644 --- a/webapp/graphite/account/urls.py +++ b/webapp/graphite/account/urls.py @@ -12,12 +12,12 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/login/?$', views.loginView, name='account_login'), - url(r'^/logout/?$', views.logoutView, name='account_logout'), - url(r'^/edit/?$', views.editProfile, name='account_edit'), - url(r'^/update/?$', views.updateProfile, name='account_update'), + re_path(r'^/login/?$', views.loginView, name='account_login'), + re_path(r'^/logout/?$', views.logoutView, name='account_logout'), + re_path(r'^/edit/?$', views.editProfile, name='account_edit'), + re_path(r'^/update/?$', views.updateProfile, name='account_update'), ] diff --git a/webapp/graphite/browser/urls.py b/webapp/graphite/browser/urls.py index 718e82f9f..cad222f74 100644 --- a/webapp/graphite/browser/urls.py +++ b/webapp/graphite/browser/urls.py @@ -12,13 +12,13 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/header/?$', views.header, name='browser_header'), - url(r'^/search/?$', views.search, name='browser_search'), - url(r'^/mygraph/?$', views.myGraphLookup, name='browser_my_graph'), - url(r'^/usergraph/?$', views.userGraphLookup, name='browser_usergraph'), - url(r'^/?$', views.browser, name='browser'), + re_path(r'^/header/?$', views.header, name='browser_header'), + re_path(r'^/search/?$', views.search, name='browser_search'), + re_path(r'^/mygraph/?$', views.myGraphLookup, name='browser_my_graph'), + re_path(r'^/usergraph/?$', views.userGraphLookup, name='browser_usergraph'), + re_path(r'^/?$', views.browser, name='browser'), ] diff --git a/webapp/graphite/composer/urls.py b/webapp/graphite/composer/urls.py index d3faefea7..15cfac4ed 100644 --- a/webapp/graphite/composer/urls.py +++ b/webapp/graphite/composer/urls.py @@ -12,10 +12,10 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/mygraph', views.mygraph, name='composer_mygraph'), - url(r'^/?$', views.composer, name='composer'), + re_path(r'^/mygraph', views.mygraph, name='composer_mygraph'), + re_path(r'^/?$', views.composer, name='composer'), ] diff --git a/webapp/graphite/dashboard/urls.py b/webapp/graphite/dashboard/urls.py index 61e07085a..8a0c48254 100644 --- a/webapp/graphite/dashboard/urls.py +++ b/webapp/graphite/dashboard/urls.py @@ -1,26 +1,26 @@ -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/save/(?P[^/]+)$', views.save, name='dashboard_save'), - url(r'^/save_template/(?P[^/]+)/(?P[^/]+)$', views.save_template, - name='dashboard_save_template'), - url(r'^/load/(?P[^/]+)$', views.load, name='dashboard_load'), - url(r'^/load/(?P[^/]+)/(?P[^/]+)$', views.load_template, - name='dashboard_load_template'), - url(r'^/load_template/(?P[^/]+)/(?P[^/]+)$', views.load_template, - name='dashboard_load_template'), - url(r'^/delete/(?P[^/]+)$', views.delete, name='dashboard_delete'), - url(r'^/create-temporary/?$', views.create_temporary, name='dashboard_create_temporary'), - url(r'^/email$', views.email, name='dashboard_email'), - url(r'^/find/?$', views.find, name='dashboard_find'), - url(r'^/delete_template/(?P[^/]+)$', views.delete_template, - name='dashboard_delete_template'), - url(r'^/find_template/?$', views.find_template, name='dashboard_find_template'), - url(r'^/login/?$', views.user_login, name='dashboard_login'), - url(r'^/logout/?$', views.user_logout, name='dashboard_logout'), - url(r'^/help/?$', views.help, name='dashboard_help'), - url(r'^/(?P[^/]+)/(?P[^/]+)$', views.template, name='dashboard_template'), - url(r'^/(?P[^/]+)$', views.dashboard, name='dashboard'), - url(r'^/?$', views.dashboard, name='dashboard'), + re_path(r'^/save/(?P[^/]+)$', views.save, name='dashboard_save'), + re_path(r'^/save_template/(?P[^/]+)/(?P[^/]+)$', views.save_template, + name='dashboard_save_template'), + re_path(r'^/load/(?P[^/]+)$', views.load, name='dashboard_load'), + re_path(r'^/load/(?P[^/]+)/(?P[^/]+)$', views.load_template, + name='dashboard_load_template'), + re_path(r'^/load_template/(?P[^/]+)/(?P[^/]+)$', views.load_template, + name='dashboard_load_template'), + re_path(r'^/delete/(?P[^/]+)$', views.delete, name='dashboard_delete'), + re_path(r'^/create-temporary/?$', views.create_temporary, name='dashboard_create_temporary'), + re_path(r'^/email$', views.email, name='dashboard_email'), + re_path(r'^/find/?$', views.find, name='dashboard_find'), + re_path(r'^/delete_template/(?P[^/]+)$', views.delete_template, + name='dashboard_delete_template'), + re_path(r'^/find_template/?$', views.find_template, name='dashboard_find_template'), + re_path(r'^/login/?$', views.user_login, name='dashboard_login'), + re_path(r'^/logout/?$', views.user_logout, name='dashboard_logout'), + re_path(r'^/help/?$', views.help, name='dashboard_help'), + re_path(r'^/(?P[^/]+)/(?P[^/]+)$', views.template, name='dashboard_template'), + re_path(r'^/(?P[^/]+)$', views.dashboard, name='dashboard'), + re_path(r'^/?$', views.dashboard, name='dashboard'), ] diff --git a/webapp/graphite/events/urls.py b/webapp/graphite/events/urls.py index e32811cda..b24e78ff8 100644 --- a/webapp/graphite/events/urls.py +++ b/webapp/graphite/events/urls.py @@ -12,11 +12,11 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/get_data?$', views.get_data, name='events_get_data'), - url(r'^/(?P\d+)/?$', views.detail, name='events_detail'), - url(r'^/?$', views.view_events, name='events'), + re_path(r'^/get_data?$', views.get_data, name='events_get_data'), + re_path(r'^/(?P\d+)/?$', views.detail, name='events_detail'), + re_path(r'^/?$', views.view_events, name='events'), ] diff --git a/webapp/graphite/functions/urls.py b/webapp/graphite/functions/urls.py index 1f48ac054..201315b0f 100644 --- a/webapp/graphite/functions/urls.py +++ b/webapp/graphite/functions/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls import url +from django.urls import re_path from graphite.functions.views import functionList, functionDetails urlpatterns = [ - url(r'^/(.+)$', functionDetails, name='functionDetails'), - url(r'^/?$', functionList, name='functionList'), + re_path(r'^/(.+)$', functionDetails, name='functionDetails'), + re_path(r'^/?$', functionList, name='functionList'), ] diff --git a/webapp/graphite/metrics/urls.py b/webapp/graphite/metrics/urls.py index cc5d55cde..1544c14c2 100644 --- a/webapp/graphite/metrics/urls.py +++ b/webapp/graphite/metrics/urls.py @@ -12,16 +12,16 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import path, re_path from . import views urlpatterns = [ - url(r'^/index\.json$', views.index_json, name='metrics_index'), - url(r'^/find/?$', views.find_view, name='metrics_find'), - url(r'^/expand/?$', views.expand_view, name='metrics_expand'), - url(r'^/get-metadata/?$', views.get_metadata_view, - name='metrics_get_metadata'), - url(r'^/set-metadata/?$', views.set_metadata_view, - name='metrics_set_metadata'), - url(r'^/?$', views.find_view, name='metrics'), + path('/index.json', views.index_json, name='metrics_index'), + re_path(r'^/find/?$', views.find_view, name='metrics_find'), + re_path(r'^/expand/?$', views.expand_view, name='metrics_expand'), + re_path(r'^/get-metadata/?$', views.get_metadata_view, + name='metrics_get_metadata'), + re_path(r'^/set-metadata/?$', views.set_metadata_view, + name='metrics_set_metadata'), + re_path(r'^/?$', views.find_view, name='metrics'), ] diff --git a/webapp/graphite/render/urls.py b/webapp/graphite/render/urls.py index dccf2c000..7ef21da31 100644 --- a/webapp/graphite/render/urls.py +++ b/webapp/graphite/render/urls.py @@ -12,12 +12,12 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/local/?$', views.renderLocalView, name='render_local'), - url(r'^/~(?P[^/]+)/(?P[^/]+)/?$', views.renderMyGraphView, - name='render_my_graph'), - url(r'^/?$', views.renderView, name='render'), + re_path(r'^/local/?$', views.renderLocalView, name='render_local'), + re_path(r'^/~(?P[^/]+)/(?P[^/]+)/?$', views.renderMyGraphView, + name='render_my_graph'), + re_path(r'^/?$', views.renderView, name='render'), ] diff --git a/webapp/graphite/tags/urls.py b/webapp/graphite/tags/urls.py index 9556c3562..8bb7824e4 100644 --- a/webapp/graphite/tags/urls.py +++ b/webapp/graphite/tags/urls.py @@ -12,16 +12,16 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import path, re_path from . import views urlpatterns = [ - url(r'^/tagSeries$', views.tagSeries, name='tagSeries'), - url(r'^/tagMultiSeries$', views.tagMultiSeries, name='tagMultiSeries'), - url(r'^/delSeries$', views.delSeries, name='delSeries'), - url(r'^/findSeries$', views.findSeries, name='findSeries'), - url(r'^/autoComplete/tags$', views.autoCompleteTags, name='tagAutoCompleteTags'), - url(r'^/autoComplete/values$', views.autoCompleteValues, name='tagAutoCompleteValues'), - url(r'^/(.+)$', views.tagDetails, name='tagDetails'), - url(r'^/?$', views.tagList, name='tagList'), + path('/tagSeries', views.tagSeries, name='tagSeries'), + path('/tagMultiSeries', views.tagMultiSeries, name='tagMultiSeries'), + path('/delSeries', views.delSeries, name='delSeries'), + path('/findSeries', views.findSeries, name='findSeries'), + path('/autoComplete/tags', views.autoCompleteTags, name='tagAutoCompleteTags'), + path('/autoComplete/values', views.autoCompleteValues, name='tagAutoCompleteValues'), + re_path(r'^/(.+)$', views.tagDetails, name='tagDetails'), + re_path(r'^/?$', views.tagList, name='tagList'), ] diff --git a/webapp/graphite/urls.py b/webapp/graphite/urls.py index 5bdee3043..7206c02b7 100644 --- a/webapp/graphite/urls.py +++ b/webapp/graphite/urls.py @@ -12,32 +12,32 @@ See the License for the specific language governing permissions and limitations under the License""" from django.conf import settings -from django.conf.urls import include, url from django.contrib import admin +from django.urls import include, path, re_path from graphite.url_shortener.views import shorten, follow from graphite.browser.views import browser graphite_urls = [ - url('^admin/', admin.site.urls), - url('^render', include('graphite.render.urls')), - url('^composer', include('graphite.composer.urls')), - url('^metrics', include('graphite.metrics.urls')), - url('^browser', include('graphite.browser.urls')), - url('^account', include('graphite.account.urls')), - url('^dashboard', include('graphite.dashboard.urls')), - url('^whitelist', include('graphite.whitelist.urls')), - url('^version', include('graphite.version.urls')), - url('^events', include('graphite.events.urls')), - url('^tags', include('graphite.tags.urls')), - url('^functions', include('graphite.functions.urls')), - url('^s/(?P.*)', shorten, name='shorten'), - url('^S/(?P[a-zA-Z0-9]+)/?$', follow, name='follow'), - url('^$', browser, name='browser'), + path('admin/', admin.site.urls), + path('render', include('graphite.render.urls')), + path('composer', include('graphite.composer.urls')), + path('metrics', include('graphite.metrics.urls')), + path('browser', include('graphite.browser.urls')), + path('account', include('graphite.account.urls')), + path('dashboard', include('graphite.dashboard.urls')), + path('whitelist', include('graphite.whitelist.urls')), + path('version', include('graphite.version.urls')), + path('events', include('graphite.events.urls')), + path('tags', include('graphite.tags.urls')), + path('functions', include('graphite.functions.urls')), + re_path('^s/(?P.*)', shorten, name='shorten'), + re_path('^S/(?P[a-zA-Z0-9]+)/?$', follow, name='follow'), + path('', browser, name='browser'), ] if settings.URL_PREFIX.strip('/'): urlpatterns = [ - url(r'^{0}/'.format(settings.URL_PREFIX.strip('/')), include(graphite_urls)), + re_path(r'^{0}/'.format(settings.URL_PREFIX.strip('/')), include(graphite_urls)), ] else: urlpatterns = graphite_urls diff --git a/webapp/graphite/version/urls.py b/webapp/graphite/version/urls.py index 6ed93988d..d47773c0d 100755 --- a/webapp/graphite/version/urls.py +++ b/webapp/graphite/version/urls.py @@ -12,9 +12,9 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import re_path from . import views urlpatterns = [ - url(r'^/?$', views.index, name='version_index'), + re_path(r'^/?$', views.index, name='version_index'), ] diff --git a/webapp/graphite/whitelist/urls.py b/webapp/graphite/whitelist/urls.py index 0030f29d1..d739f0f3e 100644 --- a/webapp/graphite/whitelist/urls.py +++ b/webapp/graphite/whitelist/urls.py @@ -12,11 +12,11 @@ See the License for the specific language governing permissions and limitations under the License.""" -from django.conf.urls import url +from django.urls import path, re_path from . import views urlpatterns = [ - url(r'^/add$', views.add, name='whitelist_add'), - url(r'^/remove$', views.remove, name='whitelist_remove'), - url(r'^/?$', views.show, name='whitelist_show'), + path('/add', views.add, name='whitelist_add'), + path('/remove', views.remove, name='whitelist_remove'), + re_path(r'^/?$', views.show, name='whitelist_show'), ]