From 08a7342e94e693d87b694104dc6d7b1b0c5f8db0 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Fri, 13 Oct 2023 10:47:34 -0400 Subject: [PATCH] Drop use of features removed in Django 4.0 These functions were deprecated in Django 3.0 and have been removed in Django 4.0. Switch to the functions they were aliased to. Closes-Bug: #2039226 Change-Id: I2180b1ccae7ca377aa5d4586bd3c5562512b5e98 --- run_tests.sh | 2 +- watcher_dashboard/api/watcher.py | 2 +- watcher_dashboard/content/action_plans/panel.py | 2 +- watcher_dashboard/content/action_plans/tables.py | 12 ++++++------ watcher_dashboard/content/action_plans/tabs.py | 2 +- watcher_dashboard/content/action_plans/views.py | 2 +- watcher_dashboard/content/actions/panel.py | 2 +- watcher_dashboard/content/actions/tables.py | 2 +- watcher_dashboard/content/actions/tabs.py | 2 +- watcher_dashboard/content/actions/views.py | 2 +- watcher_dashboard/content/audit_templates/forms.py | 2 +- watcher_dashboard/content/audit_templates/panel.py | 2 +- watcher_dashboard/content/audit_templates/tables.py | 12 ++++++------ watcher_dashboard/content/audit_templates/tabs.py | 2 +- watcher_dashboard/content/audit_templates/views.py | 2 +- watcher_dashboard/content/audits/forms.py | 2 +- watcher_dashboard/content/audits/panel.py | 2 +- watcher_dashboard/content/audits/tables.py | 8 ++++---- watcher_dashboard/content/audits/tabs.py | 2 +- watcher_dashboard/content/audits/views.py | 2 +- watcher_dashboard/content/goals/panel.py | 2 +- watcher_dashboard/content/goals/tables.py | 2 +- watcher_dashboard/content/goals/tabs.py | 2 +- watcher_dashboard/content/goals/views.py | 2 +- watcher_dashboard/content/strategies/panel.py | 2 +- watcher_dashboard/content/strategies/tables.py | 2 +- watcher_dashboard/content/strategies/tabs.py | 2 +- watcher_dashboard/content/strategies/views.py | 2 +- .../local/enabled/_31020_watcher_panelgroup.py | 2 +- 29 files changed, 42 insertions(+), 42 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index f5907ec..bc13f64 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -436,7 +436,7 @@ function run_integration_tests { function babel_extract { DOMAIN=$1 KEYWORDS="-k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2" - KEYWORDS+=" -k ugettext_noop -k ugettext_lazy -k ungettext_lazy:1,2" + KEYWORDS+=" -k gettext_noop -k gettext_lazy -k ngettext_lazy:1,2" KEYWORDS+=" -k npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3" ${command_wrapper} pybabel extract -F ../babel-${DOMAIN}.cfg -o locale/${DOMAIN}.pot $KEYWORDS . diff --git a/watcher_dashboard/api/watcher.py b/watcher_dashboard/api/watcher.py index 2418b6e..0fb4cdd 100644 --- a/watcher_dashboard/api/watcher.py +++ b/watcher_dashboard/api/watcher.py @@ -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 diff --git a/watcher_dashboard/content/action_plans/panel.py b/watcher_dashboard/content/action_plans/panel.py index 5137675..b7e858e 100644 --- a/watcher_dashboard/content/action_plans/panel.py +++ b/watcher_dashboard/content/action_plans/panel.py @@ -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 diff --git a/watcher_dashboard/content/action_plans/tables.py b/watcher_dashboard/content/action_plans/tables.py index 36d240e..80a34ff 100644 --- a/watcher_dashboard/content/action_plans/tables.py +++ b/watcher_dashboard/content/action_plans/tables.py @@ -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 diff --git a/watcher_dashboard/content/action_plans/tabs.py b/watcher_dashboard/content/action_plans/tabs.py index 868654c..2654bde 100644 --- a/watcher_dashboard/content/action_plans/tabs.py +++ b/watcher_dashboard/content/action_plans/tabs.py @@ -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 diff --git a/watcher_dashboard/content/action_plans/views.py b/watcher_dashboard/content/action_plans/views.py index b97804b..3217cd4 100644 --- a/watcher_dashboard/content/action_plans/views.py +++ b/watcher_dashboard/content/action_plans/views.py @@ -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 diff --git a/watcher_dashboard/content/actions/panel.py b/watcher_dashboard/content/actions/panel.py index 9c4c971..d882664 100644 --- a/watcher_dashboard/content/actions/panel.py +++ b/watcher_dashboard/content/actions/panel.py @@ -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 diff --git a/watcher_dashboard/content/actions/tables.py b/watcher_dashboard/content/actions/tables.py index 88b1418..d8be9e7 100644 --- a/watcher_dashboard/content/actions/tables.py +++ b/watcher_dashboard/content/actions/tables.py @@ -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 diff --git a/watcher_dashboard/content/actions/tabs.py b/watcher_dashboard/content/actions/tabs.py index 2ccae68..791f945 100644 --- a/watcher_dashboard/content/actions/tabs.py +++ b/watcher_dashboard/content/actions/tabs.py @@ -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 diff --git a/watcher_dashboard/content/actions/views.py b/watcher_dashboard/content/actions/views.py index d2e19ce..09f73b7 100644 --- a/watcher_dashboard/content/actions/views.py +++ b/watcher_dashboard/content/actions/views.py @@ -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 diff --git a/watcher_dashboard/content/audit_templates/forms.py b/watcher_dashboard/content/audit_templates/forms.py index 55fa36d..ad61d03 100644 --- a/watcher_dashboard/content/audit_templates/forms.py +++ b/watcher_dashboard/content/audit_templates/forms.py @@ -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 diff --git a/watcher_dashboard/content/audit_templates/panel.py b/watcher_dashboard/content/audit_templates/panel.py index f67cf81..fc98d1d 100644 --- a/watcher_dashboard/content/audit_templates/panel.py +++ b/watcher_dashboard/content/audit_templates/panel.py @@ -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 diff --git a/watcher_dashboard/content/audit_templates/tables.py b/watcher_dashboard/content/audit_templates/tables.py index 526eacc..77ef535 100644 --- a/watcher_dashboard/content/audit_templates/tables.py +++ b/watcher_dashboard/content/audit_templates/tables.py @@ -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 diff --git a/watcher_dashboard/content/audit_templates/tabs.py b/watcher_dashboard/content/audit_templates/tabs.py index 20fad34..dd440f8 100644 --- a/watcher_dashboard/content/audit_templates/tabs.py +++ b/watcher_dashboard/content/audit_templates/tabs.py @@ -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 diff --git a/watcher_dashboard/content/audit_templates/views.py b/watcher_dashboard/content/audit_templates/views.py index 249882f..aeb129f 100644 --- a/watcher_dashboard/content/audit_templates/views.py +++ b/watcher_dashboard/content/audit_templates/views.py @@ -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 diff --git a/watcher_dashboard/content/audits/forms.py b/watcher_dashboard/content/audits/forms.py index 449ffbb..f25fe5f 100644 --- a/watcher_dashboard/content/audits/forms.py +++ b/watcher_dashboard/content/audits/forms.py @@ -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 diff --git a/watcher_dashboard/content/audits/panel.py b/watcher_dashboard/content/audits/panel.py index 2a6523f..94c3bfa 100644 --- a/watcher_dashboard/content/audits/panel.py +++ b/watcher_dashboard/content/audits/panel.py @@ -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 diff --git a/watcher_dashboard/content/audits/tables.py b/watcher_dashboard/content/audits/tables.py index a31e0cd..d3d2b25 100644 --- a/watcher_dashboard/content/audits/tables.py +++ b/watcher_dashboard/content/audits/tables.py @@ -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 diff --git a/watcher_dashboard/content/audits/tabs.py b/watcher_dashboard/content/audits/tabs.py index 023fa80..7a1f1a4 100644 --- a/watcher_dashboard/content/audits/tabs.py +++ b/watcher_dashboard/content/audits/tabs.py @@ -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 diff --git a/watcher_dashboard/content/audits/views.py b/watcher_dashboard/content/audits/views.py index 69ca509..b2873da 100644 --- a/watcher_dashboard/content/audits/views.py +++ b/watcher_dashboard/content/audits/views.py @@ -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 diff --git a/watcher_dashboard/content/goals/panel.py b/watcher_dashboard/content/goals/panel.py index 6a304c4..2bf8c72 100644 --- a/watcher_dashboard/content/goals/panel.py +++ b/watcher_dashboard/content/goals/panel.py @@ -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 diff --git a/watcher_dashboard/content/goals/tables.py b/watcher_dashboard/content/goals/tables.py index 4c5c815..6d61458 100644 --- a/watcher_dashboard/content/goals/tables.py +++ b/watcher_dashboard/content/goals/tables.py @@ -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 diff --git a/watcher_dashboard/content/goals/tabs.py b/watcher_dashboard/content/goals/tabs.py index ea344f4..0464f4f 100644 --- a/watcher_dashboard/content/goals/tabs.py +++ b/watcher_dashboard/content/goals/tabs.py @@ -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 diff --git a/watcher_dashboard/content/goals/views.py b/watcher_dashboard/content/goals/views.py index 78d0363..bda02d2 100644 --- a/watcher_dashboard/content/goals/views.py +++ b/watcher_dashboard/content/goals/views.py @@ -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 diff --git a/watcher_dashboard/content/strategies/panel.py b/watcher_dashboard/content/strategies/panel.py index 88585df..01c2fa0 100644 --- a/watcher_dashboard/content/strategies/panel.py +++ b/watcher_dashboard/content/strategies/panel.py @@ -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 diff --git a/watcher_dashboard/content/strategies/tables.py b/watcher_dashboard/content/strategies/tables.py index d4228a5..07db783 100644 --- a/watcher_dashboard/content/strategies/tables.py +++ b/watcher_dashboard/content/strategies/tables.py @@ -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 diff --git a/watcher_dashboard/content/strategies/tabs.py b/watcher_dashboard/content/strategies/tabs.py index e75bccd..0f95764 100644 --- a/watcher_dashboard/content/strategies/tabs.py +++ b/watcher_dashboard/content/strategies/tabs.py @@ -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 diff --git a/watcher_dashboard/content/strategies/views.py b/watcher_dashboard/content/strategies/views.py index 33b895c..0a83ce0 100644 --- a/watcher_dashboard/content/strategies/views.py +++ b/watcher_dashboard/content/strategies/views.py @@ -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 diff --git a/watcher_dashboard/local/enabled/_31020_watcher_panelgroup.py b/watcher_dashboard/local/enabled/_31020_watcher_panelgroup.py index dccad6e..cd0d98b 100644 --- a/watcher_dashboard/local/enabled/_31020_watcher_panelgroup.py +++ b/watcher_dashboard/local/enabled/_31020_watcher_panelgroup.py @@ -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'