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().
https://docs.djangoproject.com/en/4.0/releases/3.0/#id3
Change-Id: I77878f84e9d10cf6a136dada81eabf4e18676250
This bug only appears to be a cosmetic one where the TZ offset
would be calculated on current_year/01/01 so would remain in
daylight saving offset when displaying the timezones list.
(Note by amotoki)
The minimum version of Babel is bumped to 2.6.0
as Babel 2.3.4 returns "New Zealand Time" instead of "New Zealand
(Auckland) Time" returned from the latest Babel (2.9.0).
It is not a good idea to handle such difference in Babel in our UT
and there is no reason to stick to Bump 2.3.4.
2.6.0 was chosen as it is available in Ubuntu Focal and there is
no more reason than this.
Change-Id: I0600086cc51cf5abcf1631565e75146114189667
Closes-bug: #1822849
In python3, super() does not always require a class and self reference.
In other words, super() is enough for most cases.
This is much simpler and it is time to switch it to the newer style.
pylint provides a check for this.
Let's enable 'super-with-arguments' check.
NOTE: _prepare_mappings() method of FormRegion in
openstack_dashboard/test/integration_tests/regions/forms.py is refactored.
super() (without explicit class and self referece) does not work when
a subclass method calls a same method in a parent class multiple times.
It looks better to prepare a separate method to provide a common logic.
Change-Id: Id9512a14be9f20dbd5ebd63d446570c7b7c825ff
Django provides safer ways to override settings.
We should avoid direct replacement of existing setting.
Change-Id: I1fbcb79d18baaae037536b180989cf69c198fa7d
This patch is a clean-up patch for refactor-error-messages bp
which remove the exception message from base message otherwise
the same exception message display twice like
this https://ibb.co/XyFWMdz .
Partially-Implements blueprint refactor-error-messages
Change-Id: I46b632dbb6701785e7d654feff336a27d6ecea9c
This feature was added in Keystone V3 API. Proposed patch adds support
to Horizon
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Closes-bug: #1766485
Change-Id: Ic20a58c76826d703b43fa6a2d77ae5f77dcda1f4
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
There are cases where leading/trailing spaces are included in passwords
We should not touch passwords input in forms and pass them to auth
backends without any modifications. The detail was discussed in
the mailing list thread [1] referred in the bug comment.
[1] http://lists.openstack.org/pipermail/openstack-discuss/2020-January/thread.html#12223
Change-Id: I98de224cc77a98fa216ec3bc032412325e661e14
Closes-Bug: #1861224
We don't support Python 2 anymore so we don't need this
compatibility library.
six.reraise usages are left as is until it'll be moved to some
base lib like oslo.utils to not re-implenent this method in
Horizon.
This patch also removes Python2-specific base test case methods
assertItemsEqual and assertNotRegexpMatches in flavor of new
Python 3 analogues.
Change-Id: I26a59176be9e9f213128e4945a58b9459334b626
Cookie-based settings related to openstack_dashboard are located
under horizon directory,, but they are not related to "horizon".
This commit moves them to "openstack_dashboard" directory.
Part of blueprint ini-based-configuration
Change-Id: Id48ececdbe819a95485e9a91dc5a1a163a5568c3
This commit mainly covers settings in the remaining files
under openstack_dashboard.
Note that HORIZON_CONFIG, horizon and openstack_auth are not covered.
They will be covered by follow-up patches.
Part of blueprint ini-based-configuration
Change-Id: Ibd70e030445a073d9a62da9867850f4893135a89
When user change password same as previous password,then user get
an error message "Unable to change password" on Horizon which
does not specify the clear reason why it cannot be change.
This patch corrects the exception raised.
Change-Id: I95acf5c579fd213d64f111010c31fe6c5a0991af
Closes-Bug: #1820102
(In Django 2.0) The django.core.urlresolvers module is removed
in favor of its new location, django.urls.
It was depreacted in Django 1.10:
https://docs.djangoproject.com/en/2.0/releases/1.10/#id3
blueprint django2-support
Change-Id: I46ab5c325491274b8eaffbf848e5d80f83c2fd26
Based on keystone commit cfbc2aa30b7406b4bc77e40a55561d1f46174b5c
keystone uses policy-in-code now, so there is a lot of differences.
The new file was generated by oslopolicy-sample-generator.
Sorted version diff is http://paste.openstack.org/show/628745/.
Removed policies are:
default
identity:change_password
identity:get_identity_providers
'identity:change_password' is used in horizon.
There seems no corresponding new policy, so the corresponding horizon
rules are dropped in this commit.
Our UT depends on the identity policy file.
This commit updates the UTs in a more robust way.
Change-Id: I76eb9f95c7112bcbad75ee151f363f892298d081
This reverts commit a880926300.
The reverted implementation depends on LOCALE_PATHS but this assumption
turns out not correct. Django searches messages catalogs LOCALE_PATHS
and locale directory in individual INSTALLED_APPS, but the usage of
LOCALE_PATHS varies on deployers and we cannot assume the default value
of LOCALE_PATSH.
In addition, the logic of auto-generating the language list cannot
handle locale name alias ('fallback' in the Django code).
Django 1.9 or later perfers to zh-hant and zh-hans, and zh-cn and
zh-tw are now defined as fallback.
We can explore a better approach for auto-generation of the language
list, but we do not have more reliable way so far. Cconsidering the
timing of Pike release, the safest approach looks like to revert
the original patch back to the manula maintenance of the lang list.
Languages with over 50% progress (based on the number of translated
messages as total) are listed in settings.LANGUAGES.
(http://paste.openstack.org/show/618254/)
Closes-Bug: #1710131
Change-Id: I5133d6317aba6107fc37bd5f30388c130b1fdaac
Previously the available language list is maintained manually.
This commit change horizon to check translation message catalog
is available for each language and generate the language list
automatically. settings.LANGUAGES is still used to determines
the initial set of languages and now defaults to the list provided
by django.
Change-Id: I9d9c934beebd7a641e2feb0d5cdfa839e0efa3c3
Closes-Bug: #1675298
attribute-level imports are not checked by hacking module now.
most noqa is used to disable warnings on attribute-level imports.
This commit drops noqa for this purpose.
After this, there are only 3 noqa under openstack_dashboard/ :)
Change-Id: I4a449802f5dbd6e44e4b8b5c378a555d47d9a99f
When the password is successfully changed, the background colour
of the success message is changed from red to green to avoid
users mistaking it for an error message.
Change-Id: Icbaae9f15d02368539e47cd5e929c19ed67b5fed
Closes-Bug: #1520486
change password same with old one will give the error:
Error: Unable to change password.
This patch make sure new password can not the same with old one.
Change-Id: Ib2261df262ba9bdf2b6d2ecb9cf5ce406893634d
Closes-bug: #1641046
Under Setttings -> User Settings OR -> Change Password
There are two title elements with the same content and shown in the same
area, remove one for better ux.
Change-Id: I863363d8fc79f5144d8ead750ba48878a7fa251b
Closes-bug: #1583319
help message at the field of number of page size is not tranlated.
When we define any form field, it seems that translation does not
work well if help_text has any variable.
This patch will fix it.
Change-Id: I106e00c0fdc073999f879ffa032e11fde7735953
Closes-Bug: #1563021
Django 1.8 altered and deprecated the existing pattern for defining
URLs. This will be removed in 1.10, meaning that many deprecation
warnings show up under Django 1.9. We should fix the URLs promptly to
avoid logspam, and to support Django 1.10 in Newton.
See
https://docs.djangoproject.com/en/1.9/releases/1.8/#django-conf-urls-patterns
Change-Id: I074d20850de59bfe678a3bc72e9f0f25bd743cbf
Partially-Implements: blueprint dj110
Previously, settings fell back to UTC
rather than using what was configured in local_settings.
Change-Id: I39113b90364fb53b3a14b2f0ad26637a438fee04
Closes-Bug: #1554522
In Feb 29(leap year), when users update user settings, error will occur.
Settings expiration is a year later and this calculation is incorrect.
This patch will fix it.
Change-Id: Id2bc6741ad3366969fbb73dc64c23430ce66f2aa
Closes-Bug: #1551099
Currently, the tooltip for the "Items per Page" field on the User
Settings page does not show the maximum value that the field could be.
Instead, the user must first enter the invalid value, only to receive an
error notification that then shows the max value that the field will
accept.
To resolve this issue, the maximum value is displayed along with the
other help text in the tooltip. The maximum value has a default value
of 1000 unless set otherwise.
Change-Id: I267cb5ac067f7f0b27224ca8dbba0c8e19199477
Closes-Bug: #1418430
There are a number of models.py files lying around. This is legacy (see
https://code.djangoproject.com/ticket/7198). This patch removes those
files.
Closes-Bug: 1516589
Change-Id: I84868107cad3a037079b24403ce1f5a8789de654
These lines of code were introduced as Horizon migrated
through several Django versions and are no longer
needed.
Change-Id: I12aae1a843fccc803859da6337a3274339a3741f
Partially-Implements: blueprint drop-dj17
mox doesn't work on Python 3, whereas mox3 works on Python 2 and Python
3. Cinder, Nova and many other projects already replaced mox with mox3.
mox3 is now maintained by OpenStack.
Partial-Implements: blueprint porting-python3
Change-Id: I10e6a9754ebd58a2640d73ec8966527c3aa1fe9a
"Items per page" value setting is applicable only to those pages
that have API supported pagination. For example, if "Items per page"
value is set to say "3" and if we go to Admin > Identity Panel > Users
page, more than "3" items will be displayed if present. This is
confusing to users. So as part of this commit, the help text is modified
to reflect this limitation.
Change-Id: Ibbd4771829f0c312134eb275c797780be2b78410
Closes-Bug: 1431364
Refactor of User settings & Password modals
Based on merged patch: https://review.openstack.org/#/c/123472/
Change-Id: Ibadfda67edc6c8c2c0a9c42c7f0ec982497005ef
Partially-Implements: blueprint form-template-to-view
Patch https://review.openstack.org/#/c/142802 adds a method of
reducing duplication of page title logic, this patch applies that change
to the project settings and the test panel views.
Change-Id: I4af59bb3c051dcd24e46aacd91c49b8fcc6c10c7
Partial-Bug: 1413749