From d6ae33196bb84d678f75d49567e14a68c51c576c Mon Sep 17 00:00:00 2001 From: yapeng Date: Thu, 10 Aug 2017 02:57:19 +0000 Subject: [PATCH] Replace patterns syntax by url The old syntax using patterns is deprecated in Django 1.8, and is removed in Django 1.10. The current version Django<1.11, this patch fix the syntax. Change-Id: I26564c97538c23378c0494739257b31dd8796f5a Closes-Bug: #1709742 --- disaster_recovery/actions/urls.py | 8 ++------ disaster_recovery/api/rest/urls.py | 7 ++----- disaster_recovery/backups/urls.py | 6 ++---- disaster_recovery/clients/urls.py | 8 ++------ disaster_recovery/jobs/urls.py | 9 ++------- disaster_recovery/sessions/urls.py | 8 ++------ disaster_recovery/urls.py | 7 ++----- 7 files changed, 14 insertions(+), 39 deletions(-) diff --git a/disaster_recovery/actions/urls.py b/disaster_recovery/actions/urls.py index fa01880..78be377 100644 --- a/disaster_recovery/actions/urls.py +++ b/disaster_recovery/actions/urls.py @@ -12,15 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. - -from django.conf.urls import patterns from django.conf.urls import url from disaster_recovery.actions import views - -urlpatterns = patterns( - '', +urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), url(r'^create/(?P[^/]+)?$', @@ -30,4 +26,4 @@ urlpatterns = patterns( url(r'^action/(?P[^/]+)?$', views.ActionView.as_view(), name='action'), -) +] diff --git a/disaster_recovery/api/rest/urls.py b/disaster_recovery/api/rest/urls.py index 429c718..250d7db 100644 --- a/disaster_recovery/api/rest/urls.py +++ b/disaster_recovery/api/rest/urls.py @@ -16,15 +16,12 @@ URL patterns for the OpenStack Dashboard. """ -from django.conf.urls import patterns from django.conf.urls import url - import rest_api -urlpatterns = patterns( - '', +urlpatterns = [ url(r'^api/clients/$', rest_api.Clients.as_view(), name="api_clients"), url(r'^api/actions/$', rest_api.ActionList.as_view(), name="api_actions"), url(r'^api/actions/job/(?P[^/]+)?$', rest_api.Actions.as_view(), name="api_actions_in_job"), -) +] diff --git a/disaster_recovery/backups/urls.py b/disaster_recovery/backups/urls.py index 724f4ac..ab12a8c 100644 --- a/disaster_recovery/backups/urls.py +++ b/disaster_recovery/backups/urls.py @@ -13,17 +13,15 @@ # limitations under the License. -from django.conf.urls import patterns from django.conf.urls import url from disaster_recovery.backups import views -urlpatterns = patterns( - '', +urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), url(r'^(?P[^/]*)$', views.DetailView.as_view(), name='detail'), url(r'^restore/(?P.*)$', views.RestoreView.as_view(), name='restore'), -) +] diff --git a/disaster_recovery/clients/urls.py b/disaster_recovery/clients/urls.py index c526723..c634906 100644 --- a/disaster_recovery/clients/urls.py +++ b/disaster_recovery/clients/urls.py @@ -12,18 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. - -from django.conf.urls import patterns from django.conf.urls import url from disaster_recovery.clients import views - -urlpatterns = patterns( - '', +urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), url(r'^(?P[^/]+)?$', views.ClientView.as_view(), name='client'), -) +] diff --git a/disaster_recovery/jobs/urls.py b/disaster_recovery/jobs/urls.py index 4d465f8..7757dc0 100644 --- a/disaster_recovery/jobs/urls.py +++ b/disaster_recovery/jobs/urls.py @@ -12,15 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import patterns from django.conf.urls import url - from disaster_recovery.jobs import views - -urlpatterns = patterns( - '', - +urlpatterns = [ url(r'^(?P[^/]+)?$', views.JobsView.as_view(), name='index'), @@ -40,4 +35,4 @@ urlpatterns = patterns( url(r'^edit_actions/(?P[^/]+)?$', views.ActionsInJobView.as_view(), name='edit_action'), -) +] diff --git a/disaster_recovery/sessions/urls.py b/disaster_recovery/sessions/urls.py index 8f5c992..6eb41f7 100644 --- a/disaster_recovery/sessions/urls.py +++ b/disaster_recovery/sessions/urls.py @@ -12,15 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import patterns from django.conf.urls import url from disaster_recovery.sessions import views - -urlpatterns = patterns( - '', - +urlpatterns = [ url(r'^(?P[^/]+)?$', views.SessionsView.as_view(), name='index'), @@ -37,4 +33,4 @@ urlpatterns = patterns( views.CreateSessionWorkflow.as_view(), name='edit'), -) +] diff --git a/disaster_recovery/urls.py b/disaster_recovery/urls.py index d48b239..5fc08e8 100644 --- a/disaster_recovery/urls.py +++ b/disaster_recovery/urls.py @@ -13,13 +13,10 @@ # limitations under the License. from django.conf.urls import include -from django.conf.urls import patterns from django.conf.urls import url - import disaster_recovery.api.rest.urls as rest_urls -urlpatterns = patterns( - '', +urlpatterns = [ url(r'', include(rest_urls)), -) +]