Replace deprecated ugettext_lazy and ungettext_lazy

The ugettext_lazy method and the ungettext_lazy method are both
deprecated since Django 3.0[1].

These were already replaced in Horizon repo by [2].

[1] https://docs.djangoproject.com/en/3.0/releases/3.0/#id3
[2] cd7c1b5110fe1f64cd9dfbeb1072b37912d0efee

Change-Id: I4008e4439d568e0ffedd575870d4bc48c1cc62e5
This commit is contained in:
Takashi Kajinami 2022-07-11 14:56:09 +09:00
parent fc63940f4a
commit ad40231928
30 changed files with 80 additions and 80 deletions

View File

@ -12,7 +12,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 _
import horizon
from openstack_dashboard.dashboards.project import dashboard

View File

@ -12,8 +12,8 @@
# 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
from horizon import tables
@ -31,7 +31,7 @@ class CreateBackupStrategy(tables.LinkAction):
class DeleteBackupStrategy(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Backup Strategy",
u"Delete Backup Strategies",
count
@ -39,7 +39,7 @@ class DeleteBackupStrategy(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Backup Strategy Deleted",
u"Backup Strategies Deleted",
count

View File

@ -15,7 +15,7 @@
"""
Views for displaying database backups.
"""
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import exceptions
from horizon import tables as horizon_tables

View File

@ -12,7 +12,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 _
from horizon import exceptions
from horizon import forms

View File

@ -12,7 +12,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 _
import horizon
from openstack_dashboard.dashboards.project import dashboard

View File

@ -15,9 +15,9 @@
from django.conf import settings
from django.template import defaultfilters as d_filters
from django.urls import reverse
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
from horizon import tables
from horizon.utils import filters
@ -101,7 +101,7 @@ class DownloadBackup(tables.LinkAction):
class DeleteBackup(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Backup",
u"Delete Backups",
count
@ -109,7 +109,7 @@ class DeleteBackup(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Deleted Backup",
u"Deleted Backups",
count

View File

@ -15,7 +15,7 @@
from unittest import mock
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from openstack_auth import policy
from openstack_dashboard import api as dash_api
from troveclient import common

View File

@ -16,7 +16,7 @@
Views for displaying database backups.
"""
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 tables as horizon_tables

View File

@ -12,7 +12,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 _
from horizon import exceptions
from horizon import forms

View File

@ -17,7 +17,7 @@ import collections
import uuid
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views.decorators.debug import sensitive_variables # noqa
from horizon import exceptions

View File

@ -14,7 +14,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 _
import horizon

View File

@ -17,8 +17,8 @@
from django import shortcuts
from django.template.defaultfilters import title # noqa
from django import urls
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
from horizon import messages
from horizon import tables
@ -45,7 +45,7 @@ class DeleteCluster(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Cluster",
u"Delete Clusters",
count
@ -53,7 +53,7 @@ class DeleteCluster(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Scheduled deletion of Cluster",
u"Scheduled deletion of Clusters",
count
@ -244,7 +244,7 @@ class ClusterShrinkAction(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Shrink Cluster",
u"Shrink Cluster",
count
@ -252,7 +252,7 @@ class ClusterShrinkAction(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Scheduled Shrinking of Cluster",
u"Scheduled Shrinking of Cluster",
count
@ -316,7 +316,7 @@ class ClusterGrowRemoveInstance(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Remove Instance",
u"Remove Instances",
count
@ -324,7 +324,7 @@ class ClusterGrowRemoveInstance(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Removed Instance",
u"Removed Instances",
count

View File

@ -15,7 +15,7 @@
# under the License.
from django import template
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import exceptions
from horizon import tabs

View File

@ -21,7 +21,7 @@ from collections import OrderedDict
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 _
from horizon import exceptions
from horizon import forms as horizon_forms

View File

@ -15,7 +15,7 @@
import builtins
from django.core import cache
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from trove_dashboard import api

View File

@ -13,7 +13,7 @@
# under the License.
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

@ -12,7 +12,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 _
import horizon
from openstack_dashboard.dashboards.project import dashboard

View File

@ -14,8 +14,8 @@
from django import shortcuts
from django import urls
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
from horizon import forms
from horizon import messages
@ -41,7 +41,7 @@ class DeleteConfiguration(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Configuration Group",
u"Delete Configuration Groups",
count
@ -49,7 +49,7 @@ class DeleteConfiguration(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Deleted Configuration Group",
u"Deleted Configuration Groups",
count
@ -149,7 +149,7 @@ class DeleteParameter(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Parameter",
u"Delete Parameters",
count
@ -157,7 +157,7 @@ class DeleteParameter(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Deleted Parameter",
u"Deleted Parameters",
count
@ -204,7 +204,7 @@ class ValuesTable(tables.DataTable):
class DetachConfiguration(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Detach Configuration Group",
u"Detach Configuration Groups",
count
@ -212,7 +212,7 @@ class DetachConfiguration(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Detached Configuration Group",
u"Detached Configuration Groups",
count

View File

@ -12,7 +12,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 _
from horizon import exceptions
from horizon import tabs

View File

@ -14,7 +14,7 @@
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 _
from horizon import exceptions
from horizon import forms as horizon_forms

View File

@ -14,7 +14,7 @@
from django.forms import ValidationError # noqa
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,8 +13,8 @@
# under the License.
from django import urls
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
from horizon import tables
@ -24,7 +24,7 @@ from trove_dashboard import api
class PublishLog(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Publish Log",
u"Publish Logs",
count
@ -32,7 +32,7 @@ class PublishLog(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Published Log",
u"Published Logs",
count
@ -48,7 +48,7 @@ class PublishLog(tables.BatchAction):
class DiscardLog(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Discard Log",
u"Discard Logs",
count
@ -56,7 +56,7 @@ class DiscardLog(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Discarded Log",
u"Discarded Logs",
count
@ -72,7 +72,7 @@ class DiscardLog(tables.BatchAction):
class EnableLog(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Enable Log",
u"Enable Logs",
count
@ -80,7 +80,7 @@ class EnableLog(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Enabled Log",
u"Enabled Logs",
count
@ -96,7 +96,7 @@ class EnableLog(tables.BatchAction):
class DisableLog(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Disable Log",
u"Disable Logs",
count
@ -104,7 +104,7 @@ class DisableLog(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Disabled Log",
u"Disabled Logs",
count

View File

@ -14,7 +14,7 @@
from django import http
from django import shortcuts
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.views import generic
from horizon import exceptions

View File

@ -12,7 +12,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 _
import horizon
from openstack_dashboard.dashboards.project import dashboard

View File

@ -22,9 +22,9 @@ from django.urls import reverse
from django.utils import html
from django.utils import safestring
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
from horizon import exceptions
from horizon import messages
@ -45,7 +45,7 @@ class DeleteInstance(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Instance",
u"Delete Instances",
count
@ -53,7 +53,7 @@ class DeleteInstance(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Scheduled deletion of Instance",
u"Scheduled deletion of Instances",
count
@ -69,7 +69,7 @@ class RestartInstance(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Restart Instance",
u"Restart Instances",
count
@ -77,7 +77,7 @@ class RestartInstance(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Restarted Instance",
u"Restarted Instances",
count
@ -98,7 +98,7 @@ class RestartInstance(tables.BatchAction):
class DetachReplica(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Detach Replica",
u"Detach Replicas",
count
@ -106,7 +106,7 @@ class DetachReplica(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Replica Detached",
u"Replicas Detached",
count
@ -141,7 +141,7 @@ class PromoteToReplicaSource(tables.LinkAction):
class EjectReplicaSource(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Eject Replica Source",
u"Eject Replica Sources",
count
@ -149,7 +149,7 @@ class EjectReplicaSource(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Ejected Replica Source",
u"Ejected Replica Sources",
count
@ -169,7 +169,7 @@ class EjectReplicaSource(tables.BatchAction):
class GrantAccess(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Grant Access",
u"Grant Access",
count
@ -177,7 +177,7 @@ class GrantAccess(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Granted Access to",
u"Granted Access to",
count
@ -203,7 +203,7 @@ class GrantAccess(tables.BatchAction):
class RevokeAccess(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Revoke Access",
u"Revoke Access",
count
@ -211,7 +211,7 @@ class RevokeAccess(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Access Revoked to",
u"Access Revoked to",
count
@ -324,7 +324,7 @@ def has_user_add_perm(request):
class DeleteUser(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete User",
u"Delete Users",
count
@ -332,7 +332,7 @@ class DeleteUser(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Deleted User",
u"Deleted Users",
count
@ -371,7 +371,7 @@ def has_database_add_perm(request):
class DeleteDatabase(tables.DeleteAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Delete Database",
u"Delete Databases",
count
@ -379,7 +379,7 @@ class DeleteDatabase(tables.DeleteAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Deleted Database",
u"Deleted Databases",
count
@ -461,7 +461,7 @@ class AttachConfiguration(tables.LinkAction):
class DetachConfiguration(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Detach Configuration Group",
u"Detach Configuration Groups",
count
@ -469,7 +469,7 @@ class DetachConfiguration(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Detached Configuration Group",
u"Detached Configuration Groups",
count
@ -662,7 +662,7 @@ class StopDatabase(tables.BatchAction):
@staticmethod
def action_present(count):
return ungettext_lazy(
return ngettext_lazy(
u"Stop Database Service",
u"Stop Database Services",
count
@ -670,7 +670,7 @@ class StopDatabase(tables.BatchAction):
@staticmethod
def action_past(count):
return ungettext_lazy(
return ngettext_lazy(
u"Database Service stopped",
u"Database Services stopped",
count

View File

@ -13,7 +13,7 @@
# under the License.
from django import template
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from horizon import exceptions
from horizon import tabs

View File

@ -19,7 +19,7 @@ from collections import OrderedDict
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 _
from horizon import exceptions
from horizon import forms as horizon_forms

View File

@ -14,7 +14,7 @@
from django.conf import settings
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

@ -12,7 +12,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 _
import horizon

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 = 'database'