From 2bea2114fb234bf25f62a5fb041e5829e29d375c Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 8 Mar 2024 17:27:31 +0100 Subject: [PATCH] Address RemovedInDjango40Warning (2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy() are deprecated in favor of the functions that they’re aliases for: django.utils.translation.gettext(), gettext_lazy(), gettext_noop(), ngettext(), and ngettext_lazy(). On top of that django.conf.urls.url() is deprecated in favor of django.urls.re_path() Since Horizon is using Django>4.0, it's highly important to cover these issues for upcoming release. https: //docs.djangoproject.com/en/4.0/releases/3.0/#id3 Change-Id: Ibefe848cf73a31608ce5e71f4847b741ec16f8ad --- adjutant_ui/api/adjutant.py | 2 +- adjutant_ui/content/default/panel.py | 2 +- adjutant_ui/content/email/forms.py | 2 +- adjutant_ui/content/email/panel.py | 2 +- adjutant_ui/content/email/urls.py | 4 ++-- adjutant_ui/content/email/views.py | 2 +- adjutant_ui/content/forgot_password/forms.py | 2 +- adjutant_ui/content/forgot_password/panel.py | 2 +- adjutant_ui/content/forgot_password/urls.py | 6 ++--- adjutant_ui/content/notifications/panel.py | 2 +- adjutant_ui/content/notifications/tables.py | 8 +++---- adjutant_ui/content/notifications/tabs.py | 2 +- adjutant_ui/content/notifications/urls.py | 8 +++---- adjutant_ui/content/notifications/views.py | 2 +- adjutant_ui/content/project_users/forms.py | 2 +- adjutant_ui/content/project_users/panel.py | 2 +- adjutant_ui/content/project_users/tables.py | 14 +++++------ adjutant_ui/content/project_users/urls.py | 12 +++++----- adjutant_ui/content/project_users/views.py | 2 +- adjutant_ui/content/quota/forms.py | 2 +- adjutant_ui/content/quota/panel.py | 2 +- adjutant_ui/content/quota/tables.py | 8 +++---- adjutant_ui/content/quota/urls.py | 16 ++++++------- adjutant_ui/content/quota/views.py | 2 +- adjutant_ui/content/signup/forms.py | 2 +- adjutant_ui/content/signup/panel.py | 2 +- adjutant_ui/content/signup/urls.py | 6 ++--- adjutant_ui/content/tasks/forms.py | 2 +- adjutant_ui/content/tasks/panel.py | 2 +- adjutant_ui/content/tasks/tables.py | 24 +++++++++---------- adjutant_ui/content/tasks/tabs.py | 2 +- adjutant_ui/content/tasks/urls.py | 14 +++++------ adjutant_ui/content/tasks/views.py | 2 +- adjutant_ui/content/token/forms.py | 2 +- adjutant_ui/content/token/panel.py | 2 +- adjutant_ui/content/token/urls.py | 6 ++--- adjutant_ui/content/token/views.py | 2 +- .../dashboards/forgot_password_dash.py | 2 +- adjutant_ui/dashboards/management.py | 2 +- adjutant_ui/dashboards/signup_dash.py | 2 +- adjutant_ui/dashboards/token_dash.py | 2 +- .../_6020_management_access_control_group.py | 2 +- .../templatetags/relabel_username_field.py | 4 ++-- run_tests.sh | 1 - tox.ini | 6 ++--- 45 files changed, 98 insertions(+), 99 deletions(-) diff --git a/adjutant_ui/api/adjutant.py b/adjutant_ui/api/adjutant.py index 809dcff..7f6dcaa 100644 --- a/adjutant_ui/api/adjutant.py +++ b/adjutant_ui/api/adjutant.py @@ -19,7 +19,7 @@ import requests from urllib.parse import urljoin from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from horizon import exceptions from horizon.utils import functions as utils diff --git a/adjutant_ui/content/default/panel.py b/adjutant_ui/content/default/panel.py index 1f2a464..ff5035b 100644 --- a/adjutant_ui/content/default/panel.py +++ b/adjutant_ui/content/default/panel.py @@ -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 diff --git a/adjutant_ui/content/email/forms.py b/adjutant_ui/content/email/forms.py index ace6a93..56a8883 100644 --- a/adjutant_ui/content/email/forms.py +++ b/adjutant_ui/content/email/forms.py @@ -13,7 +13,7 @@ # under the License. from django.forms import ValidationError -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from horizon import forms from horizon import messages diff --git a/adjutant_ui/content/email/panel.py b/adjutant_ui/content/email/panel.py index 503feed..2dd7baa 100644 --- a/adjutant_ui/content/email/panel.py +++ b/adjutant_ui/content/email/panel.py @@ -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 diff --git a/adjutant_ui/content/email/urls.py b/adjutant_ui/content/email/urls.py index 707b4d5..6553701 100644 --- a/adjutant_ui/content/email/urls.py +++ b/adjutant_ui/content/email/urls.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.email import views urlpatterns = [ - url(r'^$', views.EmailView.as_view(), name='index') + re_path(r'^$', views.EmailView.as_view(), name='index') ] diff --git a/adjutant_ui/content/email/views.py b/adjutant_ui/content/email/views.py index ca023fa..fd78a4e 100644 --- a/adjutant_ui/content/email/views.py +++ b/adjutant_ui/content/email/views.py @@ -13,7 +13,7 @@ # under the License. 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 forms diff --git a/adjutant_ui/content/forgot_password/forms.py b/adjutant_ui/content/forgot_password/forms.py index 3f5862d..c86b808 100644 --- a/adjutant_ui/content/forgot_password/forms.py +++ b/adjutant_ui/content/forgot_password/forms.py @@ -15,7 +15,7 @@ from django.conf import settings from django import forms from django import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from horizon import forms as hforms from horizon.utils import functions as utils diff --git a/adjutant_ui/content/forgot_password/panel.py b/adjutant_ui/content/forgot_password/panel.py index 0ce5c45..1bbb347 100644 --- a/adjutant_ui/content/forgot_password/panel.py +++ b/adjutant_ui/content/forgot_password/panel.py @@ -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 diff --git a/adjutant_ui/content/forgot_password/urls.py b/adjutant_ui/content/forgot_password/urls.py index aac0867..2d6f40a 100644 --- a/adjutant_ui/content/forgot_password/urls.py +++ b/adjutant_ui/content/forgot_password/urls.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.forgot_password import views # NOTE(adriant): These urls are registered in the project_users urls.py file. urlpatterns = [ - url(r'^$', views.ForgotPasswordView.as_view(), name='forgot_index'), - url(r'^sent/?$', views.password_sent_view, name='forgot_sent'), + re_path(r'^$', views.ForgotPasswordView.as_view(), name='forgot_index'), + re_path(r'^sent/?$', views.password_sent_view, name='forgot_sent'), ] diff --git a/adjutant_ui/content/notifications/panel.py b/adjutant_ui/content/notifications/panel.py index 0952470..1179afe 100644 --- a/adjutant_ui/content/notifications/panel.py +++ b/adjutant_ui/content/notifications/panel.py @@ -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 diff --git a/adjutant_ui/content/notifications/tables.py b/adjutant_ui/content/notifications/tables.py index b52e2d1..526ad3b 100644 --- a/adjutant_ui/content/notifications/tables.py +++ b/adjutant_ui/content/notifications/tables.py @@ -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 @@ -28,7 +28,7 @@ class AcknowlegeNotifcation(tables.BatchAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Acknowlege Notification", u"Acknowlege Notifications", count @@ -36,7 +36,7 @@ class AcknowlegeNotifcation(tables.BatchAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Acknowleged Notification", u"Acknowleged Notifications", count diff --git a/adjutant_ui/content/notifications/tabs.py b/adjutant_ui/content/notifications/tabs.py index 7fbffc8..add5c1c 100644 --- a/adjutant_ui/content/notifications/tabs.py +++ b/adjutant_ui/content/notifications/tabs.py @@ -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 diff --git a/adjutant_ui/content/notifications/urls.py b/adjutant_ui/content/notifications/urls.py index d288980..4a13754 100644 --- a/adjutant_ui/content/notifications/urls.py +++ b/adjutant_ui/content/notifications/urls.py @@ -13,13 +13,13 @@ # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.notifications import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^(?P[^/]+)/$', - views.NotificationDetailView.as_view(), name='detail'), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^(?P[^/]+)/$', + views.NotificationDetailView.as_view(), name='detail'), ] diff --git a/adjutant_ui/content/notifications/views.py b/adjutant_ui/content/notifications/views.py index f5da1e5..f80bcb5 100644 --- a/adjutant_ui/content/notifications/views.py +++ b/adjutant_ui/content/notifications/views.py @@ -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 tabs diff --git a/adjutant_ui/content/project_users/forms.py b/adjutant_ui/content/project_users/forms.py index 96bd03d..405b11c 100644 --- a/adjutant_ui/content/project_users/forms.py +++ b/adjutant_ui/content/project_users/forms.py @@ -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 diff --git a/adjutant_ui/content/project_users/panel.py b/adjutant_ui/content/project_users/panel.py index de055aa..9a57332 100644 --- a/adjutant_ui/content/project_users/panel.py +++ b/adjutant_ui/content/project_users/panel.py @@ -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 diff --git a/adjutant_ui/content/project_users/tables.py b/adjutant_ui/content/project_users/tables.py index 11dfd0f..e489e0f 100644 --- a/adjutant_ui/content/project_users/tables.py +++ b/adjutant_ui/content/project_users/tables.py @@ -14,8 +14,8 @@ from collections import defaultdict -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 @@ -32,7 +32,7 @@ class InviteUser(tables.LinkAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Invited User", u"Invited Users", count @@ -44,7 +44,7 @@ class ResendInvitation(tables.BatchAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Resend Invitation", u"Resend Invitations", count @@ -52,7 +52,7 @@ class ResendInvitation(tables.BatchAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Invitation re-sent", u"Invitations re-sent", count @@ -85,7 +85,7 @@ class RevokeUser(tables.DeleteAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Revoke User", u"Revoke Users", count @@ -93,7 +93,7 @@ class RevokeUser(tables.DeleteAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Revoked User", u"Revoked Users", count diff --git a/adjutant_ui/content/project_users/urls.py b/adjutant_ui/content/project_users/urls.py index 2ebcc06..878a911 100644 --- a/adjutant_ui/content/project_users/urls.py +++ b/adjutant_ui/content/project_users/urls.py @@ -12,15 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.project_users import views urlpatterns = [ - url(r'^invite/$', views.InviteUserView.as_view(), name='invite'), - url(r'^(?P[^/]+)/update/$', - views.UpdateUserView.as_view(), - name='update'), - url(r'^$', views.UsersView.as_view(), name='index') + re_path(r'^invite/$', views.InviteUserView.as_view(), name='invite'), + re_path(r'^(?P[^/]+)/update/$', + views.UpdateUserView.as_view(), + name='update'), + re_path(r'^$', views.UsersView.as_view(), name='index') ] diff --git a/adjutant_ui/content/project_users/views.py b/adjutant_ui/content/project_users/views.py index d587a57..98fee63 100644 --- a/adjutant_ui/content/project_users/views.py +++ b/adjutant_ui/content/project_users/views.py @@ -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 diff --git a/adjutant_ui/content/quota/forms.py b/adjutant_ui/content/quota/forms.py index 1bacc52..9e23a0d 100644 --- a/adjutant_ui/content/quota/forms.py +++ b/adjutant_ui/content/quota/forms.py @@ -15,7 +15,7 @@ import logging from django.urls import reverse # noqa -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/adjutant_ui/content/quota/panel.py b/adjutant_ui/content/quota/panel.py index d8b5064..9a77c41 100644 --- a/adjutant_ui/content/quota/panel.py +++ b/adjutant_ui/content/quota/panel.py @@ -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 diff --git a/adjutant_ui/content/quota/tables.py b/adjutant_ui/content/quota/tables.py index 91fb1d9..a3aaf67 100644 --- a/adjutant_ui/content/quota/tables.py +++ b/adjutant_ui/content/quota/tables.py @@ -14,8 +14,8 @@ import json -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 @@ -61,7 +61,7 @@ class CancelQuotaTask(tables.DeleteAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Cancel Quota Update", u"Cancel Quota Updates", count @@ -69,7 +69,7 @@ class CancelQuotaTask(tables.DeleteAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Cancelled Quota Update", u"Cancelled Quota Updates", count diff --git a/adjutant_ui/content/quota/urls.py b/adjutant_ui/content/quota/urls.py index f484727..2b0dba8 100644 --- a/adjutant_ui/content/quota/urls.py +++ b/adjutant_ui/content/quota/urls.py @@ -12,17 +12,17 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.quota import views urlpatterns = [ - url(r'^$', views.IndexView.as_view(), name='index'), - url(r'^region/(?P[^/]+)$', views.RegionDetailView.as_view(), - name='region_detail'), - url(r'^(?P[^/]+)/update$', - views.RegionUpdateView.as_view(), name='update'), - url(r'^size/(?P[^/]+)$', views.QuotaSizeView.as_view(), - name='size_detail'), + re_path(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^region/(?P[^/]+)$', views.RegionDetailView.as_view(), + name='region_detail'), + re_path(r'^(?P[^/]+)/update$', + views.RegionUpdateView.as_view(), name='update'), + re_path(r'^size/(?P[^/]+)$', views.QuotaSizeView.as_view(), + name='size_detail'), ] diff --git a/adjutant_ui/content/quota/views.py b/adjutant_ui/content/quota/views.py index 33deb84..669e2b6 100644 --- a/adjutant_ui/content/quota/views.py +++ b/adjutant_ui/content/quota/views.py @@ -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 diff --git a/adjutant_ui/content/signup/forms.py b/adjutant_ui/content/signup/forms.py index 4cdac88..ce481a7 100644 --- a/adjutant_ui/content/signup/forms.py +++ b/adjutant_ui/content/signup/forms.py @@ -15,7 +15,7 @@ from django.conf import settings from django import forms from django import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from horizon import forms as hforms from horizon.utils import functions as utils diff --git a/adjutant_ui/content/signup/panel.py b/adjutant_ui/content/signup/panel.py index a954594..c6dea2f 100644 --- a/adjutant_ui/content/signup/panel.py +++ b/adjutant_ui/content/signup/panel.py @@ -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 diff --git a/adjutant_ui/content/signup/urls.py b/adjutant_ui/content/signup/urls.py index c8997fb..23b1efd 100644 --- a/adjutant_ui/content/signup/urls.py +++ b/adjutant_ui/content/signup/urls.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.signup import views urlpatterns = [ - url(r'^$', views.SignupFormView.as_view(), name='index'), - url(r'^submitted/?$', views.signup_sent_view, name='submitted'), + re_path(r'^$', views.SignupFormView.as_view(), name='index'), + re_path(r'^submitted/?$', views.signup_sent_view, name='submitted'), ] diff --git a/adjutant_ui/content/tasks/forms.py b/adjutant_ui/content/tasks/forms.py index 8feb2c6..6e74c58 100644 --- a/adjutant_ui/content/tasks/forms.py +++ b/adjutant_ui/content/tasks/forms.py @@ -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 forms from horizon import messages diff --git a/adjutant_ui/content/tasks/panel.py b/adjutant_ui/content/tasks/panel.py index c6b786e..0084e57 100644 --- a/adjutant_ui/content/tasks/panel.py +++ b/adjutant_ui/content/tasks/panel.py @@ -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 diff --git a/adjutant_ui/content/tasks/tables.py b/adjutant_ui/content/tasks/tables.py index 6aa7785..cd0c4bc 100644 --- a/adjutant_ui/content/tasks/tables.py +++ b/adjutant_ui/content/tasks/tables.py @@ -12,8 +12,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 from horizon import exceptions from horizon import tables @@ -26,7 +26,7 @@ class CancelTask(tables.DeleteAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Cancel Task", u"Cancel Tasks", count @@ -34,7 +34,7 @@ class CancelTask(tables.DeleteAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Cancelled Task", u"Cancelled Tasks", count @@ -61,7 +61,7 @@ class ApproveTask(tables.BatchAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Approve Task", u"Approve Tasks", count @@ -69,7 +69,7 @@ class ApproveTask(tables.BatchAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Approved Task", u"Approved Tasks", count @@ -95,7 +95,7 @@ class ReissueToken(tables.BatchAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Reissue Token", u"Reissue Tokens", count @@ -103,7 +103,7 @@ class ReissueToken(tables.BatchAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Reissued Token", u"Reissued Tokens", count @@ -128,7 +128,7 @@ class RevalidateTask(tables.BatchAction): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Rerun Validation", u"Rerun Validation", count @@ -136,7 +136,7 @@ class RevalidateTask(tables.BatchAction): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Validation run", u"Validation run", count @@ -162,7 +162,7 @@ class ReapproveTask(ApproveTask): @staticmethod def action_present(count): - return ungettext_lazy( + return ngettext_lazy( u"Reapprove Task", u"Reapprove Tasks", count @@ -170,7 +170,7 @@ class ReapproveTask(ApproveTask): @staticmethod def action_past(count): - return ungettext_lazy( + return ngettext_lazy( u"Reapproved Task", u"Reapproved Tasks", count diff --git a/adjutant_ui/content/tasks/tabs.py b/adjutant_ui/content/tasks/tabs.py index 25d48d7..25d6c8d 100644 --- a/adjutant_ui/content/tasks/tabs.py +++ b/adjutant_ui/content/tasks/tabs.py @@ -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 diff --git a/adjutant_ui/content/tasks/urls.py b/adjutant_ui/content/tasks/urls.py index 2062af9..d0120cd 100644 --- a/adjutant_ui/content/tasks/urls.py +++ b/adjutant_ui/content/tasks/urls.py @@ -13,16 +13,16 @@ # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.tasks import views urlpatterns = [ - url(r'^(?P[^/]+)/$', - views.TaskDetailView.as_view(), - name='detail'), - url(r'^(?P[^/]+)/update/$', - views.UpdateTaskView.as_view(), name='update'), - url(r'^$', views.IndexView.as_view(), name='index'), + re_path(r'^(?P[^/]+)/$', + views.TaskDetailView.as_view(), + name='detail'), + re_path(r'^(?P[^/]+)/update/$', + views.UpdateTaskView.as_view(), name='update'), + re_path(r'^$', views.IndexView.as_view(), name='index'), ] diff --git a/adjutant_ui/content/tasks/views.py b/adjutant_ui/content/tasks/views.py index 7d28209..8fa1372 100644 --- a/adjutant_ui/content/tasks/views.py +++ b/adjutant_ui/content/tasks/views.py @@ -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 diff --git a/adjutant_ui/content/token/forms.py b/adjutant_ui/content/token/forms.py index 61de668..2228e04 100644 --- a/adjutant_ui/content/token/forms.py +++ b/adjutant_ui/content/token/forms.py @@ -15,7 +15,7 @@ from django.conf import settings from django.forms import ValidationError # noqa from django import http -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 diff --git a/adjutant_ui/content/token/panel.py b/adjutant_ui/content/token/panel.py index 2348c18..e3afcb6 100644 --- a/adjutant_ui/content/token/panel.py +++ b/adjutant_ui/content/token/panel.py @@ -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 diff --git a/adjutant_ui/content/token/urls.py b/adjutant_ui/content/token/urls.py index b373aa7..b883c25 100644 --- a/adjutant_ui/content/token/urls.py +++ b/adjutant_ui/content/token/urls.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from django.conf.urls import url +from django.urls import re_path from adjutant_ui.content.token import views urlpatterns = [ - url(r'^(?P\w+)/?$', views.submit_token_router, - name='token_verify'), + re_path(r'^(?P\w+)/?$', views.submit_token_router, + name='token_verify'), ] diff --git a/adjutant_ui/content/token/views.py b/adjutant_ui/content/token/views.py index 6b50440..c697b4c 100644 --- a/adjutant_ui/content/token/views.py +++ b/adjutant_ui/content/token/views.py @@ -15,7 +15,7 @@ from django.conf import settings from django import http -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/adjutant_ui/dashboards/forgot_password_dash.py b/adjutant_ui/dashboards/forgot_password_dash.py index 0ec980b..145cfab 100644 --- a/adjutant_ui/dashboards/forgot_password_dash.py +++ b/adjutant_ui/dashboards/forgot_password_dash.py @@ -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 diff --git a/adjutant_ui/dashboards/management.py b/adjutant_ui/dashboards/management.py index f4ce600..804bff3 100644 --- a/adjutant_ui/dashboards/management.py +++ b/adjutant_ui/dashboards/management.py @@ -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 diff --git a/adjutant_ui/dashboards/signup_dash.py b/adjutant_ui/dashboards/signup_dash.py index ddf8a81..9518f19 100644 --- a/adjutant_ui/dashboards/signup_dash.py +++ b/adjutant_ui/dashboards/signup_dash.py @@ -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 diff --git a/adjutant_ui/dashboards/token_dash.py b/adjutant_ui/dashboards/token_dash.py index fe44499..dadd865 100644 --- a/adjutant_ui/dashboards/token_dash.py +++ b/adjutant_ui/dashboards/token_dash.py @@ -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 diff --git a/adjutant_ui/enabled/_6020_management_access_control_group.py b/adjutant_ui/enabled/_6020_management_access_control_group.py index e0586e3..fd15dc7 100644 --- a/adjutant_ui/enabled/_6020_management_access_control_group.py +++ b/adjutant_ui/enabled/_6020_management_access_control_group.py @@ -1,4 +1,4 @@ -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 = 'access_control' diff --git a/adjutant_ui/templatetags/relabel_username_field.py b/adjutant_ui/templatetags/relabel_username_field.py index ccdf421..37c0730 100644 --- a/adjutant_ui/templatetags/relabel_username_field.py +++ b/adjutant_ui/templatetags/relabel_username_field.py @@ -15,7 +15,7 @@ from django.conf import settings from django import template -from django.utils.translation import ugettext_lazy +from django.utils.translation import gettext_lazy register = template.Library() @@ -34,7 +34,7 @@ def relabel_username_field(context): if (hasattr(settings, 'USERNAME_IS_EMAIL') and getattr(settings, 'USERNAME_IS_EMAIL')): try: - context['form'].fields['username'].label = ugettext_lazy('Email') + context['form'].fields['username'].label = gettext_lazy('Email') except Exception: pass return u"" diff --git a/run_tests.sh b/run_tests.sh index 9fa0cd9..60132d9 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -412,7 +412,6 @@ 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 npgettext:1c,2,3 -k pgettext_lazy:1c,2 -k npgettext_lazy:1c,2,3" mkdir -p locale diff --git a/tox.ini b/tox.ini index 1b824b8..8b215db 100644 --- a/tox.ini +++ b/tox.ini @@ -65,7 +65,7 @@ import_exceptions = collections.defaultdict, django.conf.settings, django.conf.urls.include, django.conf.urls.patterns, - django.conf.urls.url, + django.urls.re_path, django.urls.reverse, django.urls.reverse_lazy, django.template.loader.render_to_string, @@ -78,7 +78,7 @@ import_exceptions = collections.defaultdict, django.utils.safestring.mark_safe, django.utils.translation.npgettext_lazy, django.utils.translation.pgettext_lazy, - django.utils.translation.ugettext_lazy, - django.utils.translation.ungettext_lazy, + django.utils.translation.gettext_lazy, + django.utils.translation.ngettext_lazy, operator.attrgetter, StringIO.StringIO