Commit Graph

6 Commits

Author SHA1 Message Date
Akihiro Motoki a9d5273f3c Address RemovedInDjango40Warning (1)
force_text() is deprecated in favor of force_str()
smart_text() is deprecated in favor of smart_str()

https://docs.djangoproject.com/en/4.0/releases/3.0/#django-utils-encoding-force-text-and-smart-text

Change-Id: Ic462fa8c3dfa26e8196df19fef5044036a9e97b4
2022-01-31 22:42:41 +09:00
Akihiro Motoki e5d09edc20 Use python3-style super()
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
2020-10-15 14:37:20 +09:00
Akihiro Motoki 4fc1b9c424 Remove six.reraise usage
six.reraise can be converted into "raise new_exc from original_exc"
introduced in python3.

In case of horizon.exceptions.handle(), six.reraise was used to
raise the original exception again, so we can convert it into "raise".

six is removed from requirements.txt.
Note that we need to keep six in lower-constraints.txt
as dependent libraries still use six.

Change-Id: I0672a516083727c245f1d4fa5b10eed9cd81a726
2020-01-17 07:31:26 +09:00
Ivan Kolodyazhny d870b40583 Remove six usage from openstack_dashboard package
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
2020-01-15 12:47:48 +02:00
manchandavishal c02b9fc2dd Get rid of keys() usage
for x in some_dict.keys() can be written as for x in some_dict

Change-Id: If5436647a30c02d0dab7daa23b2290456c66d654
2018-11-30 11:15:27 +00:00
Radomir Dopieralski 9b0c511ca6 Use oslo.config for Horizon configuration
This patch adds the infrastructure needed to move the configuration
of Horizon into oslo.config-compatible configuration file, instead of
the Django's Python-based configuration. It doesn't actually define
any configuration options, just the mechanism for loading them and the
additional types necessary to handle Horizon's complex configuration,
and the integration with oslo-config-generator.

Subsequent patches will add groups of options, making it possible to use
them in the local_settings.conf file instead of the local_settings.py
file. Note, that the options specified in the local_settings.py file
will continue to work.

Partially-Implements: blueprint ini-based-configuration
Change-Id: I2ed79ef0c6ac6d3816bba13346b7d001c46a7e80
2017-11-27 17:03:56 +09:00