Django 4.x: Replace removed features

ugettext_lazy(), ungettext_lazy(), and django.urls.url() are
removed in 4.0.
https: //docs.djangoproject.com/en/4.0/releases/4.0/

Change-Id: I7747087589b6ec96792d77aae5fb452c1b5661bb
This commit is contained in:
Corey Bryant 2022-07-19 15:43:36 -04:00
parent b526383eba
commit 56094cec47
35 changed files with 78 additions and 77 deletions

View File

@ -13,7 +13,7 @@
import logging
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from openstack_dashboard.api import base
from watcherclient import client as wc

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon

View File

@ -17,9 +17,9 @@ import logging
from django.template.defaultfilters import title # noqa
from django import urls
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext_lazy
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
import horizon.exceptions
import horizon.messages
import horizon.tables
@ -55,7 +55,7 @@ class ArchiveActionPlan(horizon.tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Archive Action Plan",
u"Archive Action Plans",
count
@ -63,7 +63,7 @@ class ArchiveActionPlan(horizon.tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Action Plan archived",
u"Action Plans archived",
count
@ -81,7 +81,7 @@ class StartActionPlan(horizon.tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Start Action Plan",
u"Start Action Plans",
count
@ -89,7 +89,7 @@ class StartActionPlan(horizon.tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Action Plan started",
u"Action Plans started",
count

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import tabs

View File

@ -13,16 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import urls
from django.urls import re_path
from watcher_dashboard.content.action_plans import views
urlpatterns = [
urls.url(r'^$',
re_path(r'^$',
views.IndexView.as_view(), name='index'),
urls.url(r'^(?P<action_plan_uuid>[^/]+)/detail$',
re_path(r'^(?P<action_plan_uuid>[^/]+)/detail$',
views.DetailView.as_view(), name='detail'),
urls.url(r'^archive/$',
re_path(r'^archive/$',
views.ArchiveView.as_view(), name='archive'),
]

View File

@ -15,7 +15,7 @@
import logging
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
from horizon import forms
import horizon.tables

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon

View File

@ -17,8 +17,8 @@ import logging
from django.template.defaultfilters import title # noqa
from django import urls
from django.utils.translation import gettext_lazy as _
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
import horizon.exceptions
import horizon.messages
import horizon.tables

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import tabs

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import urls
from django.urls import re_path
from watcher_dashboard.content.actions import views
urlpatterns = [
urls.url(r'^$',
re_path(r'^$',
views.IndexView.as_view(), name='index'),
urls.url(r'^(?P<action_uuid>[^/]+)/detail$',
re_path(r'^(?P<action_uuid>[^/]+)/detail$',
views.DetailView.as_view(), name='detail'),
]

View File

@ -15,7 +15,7 @@
import collections
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
import horizon.tables
import horizon.tabs

View File

@ -20,7 +20,7 @@ import logging
from django.core import exceptions as core_exc
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext_lazy
import horizon.exceptions
import horizon.messages
import horizon.tables
@ -49,7 +49,7 @@ class LaunchAudit(horizon.tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
"Launch Audit",
"Launch Audits",
count
@ -57,7 +57,7 @@ class LaunchAudit(horizon.tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
"Launched Audit",
"Launched Audits",
count
@ -76,7 +76,7 @@ class ArchiveAuditTemplates(horizon.tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
"Archive Template",
"Archive Templates",
count
@ -84,7 +84,7 @@ class ArchiveAuditTemplates(horizon.tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
"Archived Template",
"Archived Templates",
count

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import tabs

View File

@ -13,15 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import urls
from django.urls import re_path
from watcher_dashboard.content.audit_templates import views
urlpatterns = [
urls.url(r'^$', views.IndexView.as_view(), name='index'),
urls.url(r'^create/$', views.CreateView.as_view(), name='create'),
urls.url(r'^(?P<audit_template_uuid>[^/]+)/detail$',
re_path(r'^$', views.IndexView.as_view(), name='index'),
re_path(r'^create/$', views.CreateView.as_view(), name='create'),
re_path(r'^(?P<audit_template_uuid>[^/]+)/detail$',
views.DetailView.as_view(),
name='detail'),
]

View File

@ -17,7 +17,7 @@ import json
import logging
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
from horizon import forms
import horizon.tables

View File

@ -19,7 +19,7 @@ Forms for starting Watcher Audits.
import logging
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import exceptions
from horizon import forms

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon

View File

@ -16,9 +16,9 @@
from django import shortcuts
from django.template.defaultfilters import title # noqa
from django import urls
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ngettext_lazy
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
import horizon.exceptions
import horizon.messages
import horizon.tables
@ -88,7 +88,7 @@ class ArchiveAudits(horizon.tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
"Archive Audit",
"Archive Audits",
count
@ -96,7 +96,7 @@ class ArchiveAudits(horizon.tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
"Archived Audit",
"Archived Audits",
count

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import tabs

View File

@ -13,16 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import urls
from django.urls import re_path
from watcher_dashboard.content.audits import views
urlpatterns = [
urls.url(r'^$',
re_path(r'^$',
views.IndexView.as_view(), name='index'),
urls.url(r'^create/$',
re_path(r'^create/$',
views.CreateView.as_view(), name='create'),
urls.url(r'^(?P<audit_uuid>[^/]+)/detail$',
re_path(r'^(?P<audit_uuid>[^/]+)/detail$',
views.DetailView.as_view(), name='detail'),
]

View File

@ -17,7 +17,7 @@ import logging
from django.urls import reverse
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
from horizon import forms
import horizon.tables

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon

View File

@ -14,7 +14,7 @@
# limitations under the License.
from django.template.defaultfilters import title # noqa
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
import horizon.messages
import horizon.tables

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import tabs

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import urls
from django.urls import re_path
from watcher_dashboard.content.goals import views
urlpatterns = [
urls.url(r'^$',
re_path(r'^$',
views.IndexView.as_view(), name='index'),
urls.url(r'^(?P<goal_uuid>[^/]+)/detail$',
re_path(r'^(?P<goal_uuid>[^/]+)/detail$',
views.DetailView.as_view(), name='detail'),
]

View File

@ -15,7 +15,7 @@
import logging
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
import horizon.tables
import horizon.tabs

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
import horizon.messages
import horizon.tables

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import tabs

View File

@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from django.conf import urls
from django.urls import re_path
from watcher_dashboard.content.strategies import views
urlpatterns = [
urls.url(r'^$',
re_path(r'^$',
views.IndexView.as_view(), name='index'),
urls.url(r'^(?P<strategy_uuid>[^/]+)/detail$',
re_path(r'^(?P<strategy_uuid>[^/]+)/detail$',
views.DetailView.as_view(), name='detail'),
]

View File

@ -15,7 +15,7 @@
import logging
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
import horizon.exceptions
import horizon.tables
import horizon.tabs

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
# The slug of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'watcher'

View File

@ -12,8 +12,9 @@
# under the License.
from django.conf import urls
from django.urls import re_path
import openstack_dashboard.urls
urlpatterns = [
urls.url(r'', urls.include(openstack_dashboard.urls))
re_path(r'', urls.include(openstack_dashboard.urls))
]