Django 4.x: fix some import error
* ugettext_lazy is removed In Django 3.0 ugettext_lazy/ungettext_lazy have been deprecated in favor of gettext_lazy/ngettext_lazy [0]. * urlunquote is removed In Django 3.0 django.utils.http.urlquote/urlquote_plus/urlunquote/urlunquote have been deprecated in favor of the functions that they're aliases for: urllib.parse.quote/quote_plus/unquote/unquote_plus [0]. We are now using Django 4.2, so we should update our code with the gettext_lazy/ngettext_lazy aliases. [0] https://docs.djangoproject.com/en/3.0/releases/3.0/#id3 Change-Id: I2fe090fe170dd832deb9cf454a0400303d2e3d92
This commit is contained in:
parent
f99ce40c08
commit
eb4d103c3f
|
@ -16,7 +16,7 @@
|
|||
import itertools
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from horizon.utils import functions as utils
|
||||
from horizon.utils import memoized
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
import horizon
|
||||
|
||||
|
|
|
@ -13,7 +13,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
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
# limitations 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
|
||||
|
|
|
@ -12,7 +12,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
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
# limitations under the License.
|
||||
|
||||
from django.urls import reverse
|
||||
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 exceptions
|
||||
from horizon import tables
|
||||
|
@ -38,7 +38,7 @@ class HostFilterAction(tables.FilterAction):
|
|||
class DeleteHost(tables.DeleteAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
return ngettext_lazy(
|
||||
u"Delete Host",
|
||||
u"Delete Hosts",
|
||||
count
|
||||
|
@ -46,7 +46,7 @@ class DeleteHost(tables.DeleteAction):
|
|||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
return ngettext_lazy(
|
||||
u"Deleted Host",
|
||||
u"Deleted Hosts",
|
||||
count
|
||||
|
|
|
@ -12,7 +12,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
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
from django.conf import settings
|
||||
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
|
||||
|
|
|
@ -12,7 +12,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
|
||||
|
||||
|
|
|
@ -12,7 +12,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 tables
|
||||
from horizon.utils import filters
|
||||
|
|
|
@ -12,7 +12,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 exceptions
|
||||
from horizon import tabs
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
# limitations under the License.
|
||||
|
||||
from unittest import mock
|
||||
from urllib import parse
|
||||
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
from django.utils.http import urlunquote
|
||||
|
||||
from masakaridashboard.notifications import tables as notification_tab
|
||||
from masakaridashboard.test import helpers as test
|
||||
|
@ -49,7 +49,7 @@ class NotificationTest(test.TestCase):
|
|||
'masakaridashboard.api.api.notification_list',
|
||||
return_value=[notifications,
|
||||
has_more, has_prev]) as mock_notification_list:
|
||||
res = self.client.get(urlunquote(url))
|
||||
res = self.client.get(parse.unquote(url))
|
||||
self.assertEqual(res.status_code, 200)
|
||||
self.assertTemplateUsed(res,
|
||||
'masakaridashboard/notifications/index.html')
|
||||
|
|
|
@ -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 tables
|
||||
|
|
|
@ -14,7 +14,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
|
||||
|
|
|
@ -13,7 +13,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
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
from django.template import defaultfilters as filters
|
||||
from django.urls import reverse
|
||||
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 masakaridashboard.api import api
|
||||
|
||||
|
@ -58,7 +58,7 @@ class SegmentFilterAction(tables.FilterAction):
|
|||
class DeleteSegment(tables.DeleteAction):
|
||||
@staticmethod
|
||||
def action_present(count):
|
||||
return ungettext_lazy(
|
||||
return ngettext_lazy(
|
||||
u"Delete Segment",
|
||||
u"Delete Segments",
|
||||
count
|
||||
|
@ -66,7 +66,7 @@ class DeleteSegment(tables.DeleteAction):
|
|||
|
||||
@staticmethod
|
||||
def action_past(count):
|
||||
return ungettext_lazy(
|
||||
return ngettext_lazy(
|
||||
u"Deleted Segment",
|
||||
u"Deleted Segments",
|
||||
count
|
||||
|
|
|
@ -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 tabs
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
from urllib import parse
|
||||
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
from django.utils.http import urlunquote
|
||||
from openstack_dashboard.test import helpers
|
||||
|
||||
from masakaridashboard.segments import tables as segment_table
|
||||
|
@ -77,7 +77,7 @@ class SegmentTest(test.TestCase):
|
|||
'masakaridashboard.api.api.get_segment_list',
|
||||
return_value=[segments,
|
||||
has_more, has_prev]) as mock_get_segment_list:
|
||||
res = self.client.get(urlunquote(url))
|
||||
res = self.client.get(parse.unquote(url))
|
||||
self.assertEqual(res.status_code, 200)
|
||||
self.assertTemplateUsed(res, 'masakaridashboard/segments/index.html')
|
||||
mock_get_segment_list.assert_called_once_with(
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
from django.conf import settings
|
||||
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 tables
|
||||
from masakaridashboard.api import api
|
||||
|
|
Loading…
Reference in New Issue