From 56ca3fb094bd8750767dce4f32b5c13e6174ac2f Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Tue, 15 May 2018 06:13:33 +0900 Subject: [PATCH] Django 2.0 support Replace django.core.urlresolves with django.urls (In Django 2.0) The django.core.urlresolvers module is removed in favor of its new location, django.urls. It was deprecated in Django 1.10: https://docs.djangoproject.com/en/2.0/releases/1.10/#id3 Add py35dj20 job to test Django 2.0 integration. Change-Id: If4cb1ed6e1a15dc7acb7e9f3d8e564c23c9326c1 --- .zuul.yaml | 6 ++++++ senlin_dashboard/cluster/clusters/forms.py | 2 +- senlin_dashboard/cluster/clusters/tables.py | 4 ++-- senlin_dashboard/cluster/clusters/tests.py | 2 +- senlin_dashboard/cluster/clusters/views.py | 4 ++-- senlin_dashboard/cluster/nodes/forms.py | 2 +- senlin_dashboard/cluster/nodes/tables.py | 2 +- senlin_dashboard/cluster/nodes/tests.py | 2 +- senlin_dashboard/cluster/nodes/views.py | 2 +- senlin_dashboard/cluster/policies/forms.py | 2 +- senlin_dashboard/cluster/policies/tests.py | 2 +- senlin_dashboard/cluster/policies/views.py | 2 +- senlin_dashboard/cluster/profiles/forms.py | 2 +- senlin_dashboard/cluster/profiles/tests.py | 2 +- senlin_dashboard/cluster/profiles/views.py | 2 +- senlin_dashboard/cluster/receivers/forms.py | 2 +- senlin_dashboard/cluster/receivers/tables.py | 2 +- senlin_dashboard/cluster/receivers/tests.py | 2 +- senlin_dashboard/cluster/receivers/views.py | 2 +- 19 files changed, 26 insertions(+), 20 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 67a39c42..58d8a828 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,6 +2,12 @@ check: jobs: - openstack-tox-lower-constraints + - horizon-openstack-tox-py35dj20: + required-projects: + openstack/horizon gate: jobs: - openstack-tox-lower-constraints + - horizon-openstack-tox-py35dj20: + required-projects: + openstack/horizon diff --git a/senlin_dashboard/cluster/clusters/forms.py b/senlin_dashboard/cluster/clusters/forms.py index 0e0de46e..7ef625dc 100644 --- a/senlin_dashboard/cluster/clusters/forms.py +++ b/senlin_dashboard/cluster/clusters/forms.py @@ -13,7 +13,7 @@ import six import yaml -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/clusters/tables.py b/senlin_dashboard/cluster/clusters/tables.py index 38cef691..208fd03f 100644 --- a/senlin_dashboard/cluster/clusters/tables.py +++ b/senlin_dashboard/cluster/clusters/tables.py @@ -10,9 +10,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy from django.template import defaultfilters +from django.urls import reverse +from django.urls import reverse_lazy from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy diff --git a/senlin_dashboard/cluster/clusters/tests.py b/senlin_dashboard/cluster/clusters/tests.py index cf4fe7ad..be3cf80f 100644 --- a/senlin_dashboard/cluster/clusters/tests.py +++ b/senlin_dashboard/cluster/clusters/tests.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse from django import http +from django.urls import reverse from mox3.mox import IsA diff --git a/senlin_dashboard/cluster/clusters/views.py b/senlin_dashboard/cluster/clusters/views.py index a4cece0d..0d3e4172 100644 --- a/senlin_dashboard/cluster/clusters/views.py +++ b/senlin_dashboard/cluster/clusters/views.py @@ -10,8 +10,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from senlin_dashboard.api import senlin diff --git a/senlin_dashboard/cluster/nodes/forms.py b/senlin_dashboard/cluster/nodes/forms.py index bfdd8b3e..c3f94d01 100644 --- a/senlin_dashboard/cluster/nodes/forms.py +++ b/senlin_dashboard/cluster/nodes/forms.py @@ -13,7 +13,7 @@ import six import yaml -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/nodes/tables.py b/senlin_dashboard/cluster/nodes/tables.py index 5310f00a..29097f97 100644 --- a/senlin_dashboard/cluster/nodes/tables.py +++ b/senlin_dashboard/cluster/nodes/tables.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse_lazy from django.utils.translation import pgettext_lazy from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy diff --git a/senlin_dashboard/cluster/nodes/tests.py b/senlin_dashboard/cluster/nodes/tests.py index 99807235..0cc703cf 100644 --- a/senlin_dashboard/cluster/nodes/tests.py +++ b/senlin_dashboard/cluster/nodes/tests.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse from django import http +from django.urls import reverse from mox3.mox import IsA diff --git a/senlin_dashboard/cluster/nodes/views.py b/senlin_dashboard/cluster/nodes/views.py index fdc92eb6..990d1d7f 100644 --- a/senlin_dashboard/cluster/nodes/views.py +++ b/senlin_dashboard/cluster/nodes/views.py @@ -12,7 +12,7 @@ import yaml -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/policies/forms.py b/senlin_dashboard/cluster/policies/forms.py index 528ba996..760af83d 100644 --- a/senlin_dashboard/cluster/policies/forms.py +++ b/senlin_dashboard/cluster/policies/forms.py @@ -17,8 +17,8 @@ Forms for managing policies. import six import yaml -from django.core.urlresolvers import reverse from django.forms import ValidationError +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/policies/tests.py b/senlin_dashboard/cluster/policies/tests.py index f4a5ca3e..2eca8e7d 100644 --- a/senlin_dashboard/cluster/policies/tests.py +++ b/senlin_dashboard/cluster/policies/tests.py @@ -12,8 +12,8 @@ import yaml -from django.core.urlresolvers import reverse from django import http +from django.urls import reverse from mox3.mox import IsA diff --git a/senlin_dashboard/cluster/policies/views.py b/senlin_dashboard/cluster/policies/views.py index d907ed9b..01c31652 100644 --- a/senlin_dashboard/cluster/policies/views.py +++ b/senlin_dashboard/cluster/policies/views.py @@ -12,7 +12,7 @@ import yaml -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from senlin_dashboard.api import senlin diff --git a/senlin_dashboard/cluster/profiles/forms.py b/senlin_dashboard/cluster/profiles/forms.py index 762ddf17..b3ef324e 100644 --- a/senlin_dashboard/cluster/profiles/forms.py +++ b/senlin_dashboard/cluster/profiles/forms.py @@ -19,8 +19,8 @@ import yaml from senlinclient.common import utils -from django.core.urlresolvers import reverse from django.forms import ValidationError +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/profiles/tests.py b/senlin_dashboard/cluster/profiles/tests.py index 59e5d8ea..d3fb4a78 100644 --- a/senlin_dashboard/cluster/profiles/tests.py +++ b/senlin_dashboard/cluster/profiles/tests.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse from django import http +from django.urls import reverse from mox3.mox import IsA diff --git a/senlin_dashboard/cluster/profiles/views.py b/senlin_dashboard/cluster/profiles/views.py index 77ad05d5..1ccda824 100644 --- a/senlin_dashboard/cluster/profiles/views.py +++ b/senlin_dashboard/cluster/profiles/views.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/receivers/forms.py b/senlin_dashboard/cluster/receivers/forms.py index 8e7a956f..2e79bcf6 100644 --- a/senlin_dashboard/cluster/receivers/forms.py +++ b/senlin_dashboard/cluster/receivers/forms.py @@ -17,8 +17,8 @@ Forms for managing receivers. import six import yaml -from django.core.urlresolvers import reverse from django.forms import ValidationError +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions diff --git a/senlin_dashboard/cluster/receivers/tables.py b/senlin_dashboard/cluster/receivers/tables.py index b557b2a8..2d4c249f 100644 --- a/senlin_dashboard/cluster/receivers/tables.py +++ b/senlin_dashboard/cluster/receivers/tables.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy diff --git a/senlin_dashboard/cluster/receivers/tests.py b/senlin_dashboard/cluster/receivers/tests.py index 2b791b5a..8dce6239 100644 --- a/senlin_dashboard/cluster/receivers/tests.py +++ b/senlin_dashboard/cluster/receivers/tests.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse from django import http +from django.urls import reverse from mox3.mox import IsA diff --git a/senlin_dashboard/cluster/receivers/views.py b/senlin_dashboard/cluster/receivers/views.py index 0c3a33b6..5b606e25 100644 --- a/senlin_dashboard/cluster/receivers/views.py +++ b/senlin_dashboard/cluster/receivers/views.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.core.urlresolvers import reverse_lazy +from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from horizon import exceptions