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
This pylint check 'no-else-return' might be debatable.
but as far as I checked it works in most cases.
Change-Id: Ie8574d4a529454c6e050fa62a7a17ea097d00240
django-compress doesn't work well with cache. If horizon is
deployed in a containarized environment with pre-built static
in images, django-compress tries to load old templates from cache.
This patch introduces following changes:
* update_angular_template_hash uses the correct Django cache backend now
* fixed cache cleanup for memcached backend
* added clean_angular_template_cache management command to clean cache
manually without executing heavy 'compress' command.
Closes-Bug: #1874657
Change-Id: If1fd61fa2e4b36e22797b0f54ac067a2a937f369
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
Use the real python executable as shebang
Use exec instead of execfile if using python 3
Change-Id: I8acea40851c7e9dc248751be967859b2b9430af7
Closes-Bug: #1836580
SHOW_KEYSTONE_V2_RC is deprecated since Stein release and it's safe
to remove it now.
Keystone v2 support removal will be implemented in a follow up patch.
Change-Id: Ib3098789a3aef47f4f4b84fd56f03376ce2ea96f
This command checks the configuration for invalid and deprecated
settings, as described in
https://governance.openstack.org/tc/goals/stein/upgrade-checkers.html
There is also a script in tools/find_settings.py that scans all python
files for the potential new settings, which is supposed to make it
easier to update the lists that the checks use.
Change-Id: Ie85cf4be3da1ab446c10883a4580e20ea154b67c
Story: 2003657
Task: 26132
It seems pylint cannot handle distutils imports
and shows "import-error" error. I believe it sounds
reasonable to ignore this case.
Change-Id: Ia08b4fbf8c3270aa37cd88967add8258f6b26377
Fix the following new errors:
* E305 expected 2 blank lines after class or function definition, found 1
* E126 continuation line over-indented for hanging indent
max_line_length is set to 80 as the default value in pycodestyle is 79
but horizon uses 80 as max_line_length.
Ignore W504 and F405 by configurations.
Reasons of disabling them are explained as comments in tox.ini.
Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
Django 1.4 stopped creating django.wsgi files and the common
practice now for a while has been a wsgi.py since it is actually
python code, and should actually be importable.
Right now someone has to copy and rename the existing file if they
want to use it with a server like gunicorn.
This patch adds a new file in location that is importable via python
and adds a deprecation log to the old one.
This also updates the wsgi generation commands to instead create
'horizon_wsgi.py' and have the apache conf generation also use that
or the default wsgi file.
Change-Id: I0f8bd16c8973ad23bcd8f73b54584dc69e5aed0c
Closes-Bug: #1763204
In Python 3.5 with Django 2.0 env, some tests fail.
This commit fixes them.
blueprint django2-support
Change-Id: Ib5ba46d501956ebc7d4f69f17ee86f44319418d2
Previously the help message of update_catalog shows all available
languages in the command example. It is difficult to understand
what an exact command line is expected.
This commit uses metavar to simplify the brief command line
and shows available languages in the help text.
Similar change is made to 'domain' argument of update_catalog
and of extract_messages.
Also the default values are added in the help message.
Change-Id: I63efea7e368eb1dfaf203ca4c515eb57173b571e
The pofile name in the pseudo translation logic appears to expect the
babel.messages object, not the string holding the location of the pofile.
Trimmed a string that gettext reacts poorly with when creating pseudo-
translations.
Change-Id: I811711412d85a989826a946d1d57ed39790e34ed
Closes-Bug: 1710003
Currently horizon/locale/{django,djangojs}.js contain strings from
openstack_dashboard and vice versa. To avoid this, --input-dirs
option needs to be passed to python setup.py extract_messages.
Change-Id: Iee874616f4c037cc68bc3b0c7d8586d86f7153f4
Closes-Bug: #1710396
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.
Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.
Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
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
The additional extract_messages call in the pep8 tox environment
generates a lot of meaningless output, that then makes it difficult
to spot actual failures and warnings. This patch makes the Django
command respect the verbosity setting and call the setup.py command
with a quiet flag if low verbosity is requested, considerably decreasing
the amount of useless output. It then sets that verbosity to low in the
corresponding tox environment.
Change-Id: I2976250a23e800fbb582726299670b57199b58a7
By default apache spawns only one process for the wsgi app if not specified.
This patch detects the number of CPUS to configure n CPUs +1 processes by
default and allows to specify the number of processes explicitly.
Change-Id: I684ecd15193cef169d7a86f66a47b7d1d76c1c24
Closes-Bug: #1658048
- Updated tox envlist, so just running `tox` from the CLI will now run all
voting gate tests
- Reduce duplicated definitions and commands
- Remove any reliance on run_tests within tox
- Removes all doc references to run_tests.sh, and replaces them
with their tox equivalent. Where necessary, language around the tox
commands has been altered or extended so that it makes sense and is
consistent with other parts of the docs. Also adds a new "Test Environment"
list to the docs, so that newcomers do not have to piece together CLI
commands and their cryptic extensions from tox.ini
- Move the inline shell scripting to its own file. Also fixes a bug when
passing args, since the logic assumed you were attempting a subset test
run (try `tox -e py27 -- --pdb` on master to compare)
- Moved translation tooling from run_tests to manage.py, w/ help text
and arg restrictions. This is much more flexible so that plugins can use
it without having to copy commands, but still defaults to exactly the
same parameters/behaviour from run_tests. Docs updated appropriately.
- Removed npm/karma strange reliance on either .venv or tox/py27. Now
it only uses tox/npm.
Change-Id: I883f885bd424955d39ddcfde5ba396a88cfc041e
Implements: blueprint enhance-tox
Closes-Bug: 1638672
This resolves the following error when trying to run Horizon if it has
been installed via "django-admin make_web_conf --wgi":
AppRegistryNotReady: The translation infrastructure cannot be
initialized before the apps registry is ready. Check that you don't
make non-lazy gettext calls at import time.
and is backwards-compatible with our currently supported versions.
Closes-Bug: #1497986
Change-Id: I643058bb82f8e0f11b38ce0dd046773e91e053c3
We try to detect apache's version.
Some distributions do not allow launching apache commands (even for detection)
if not root, so we gracefully fall back on 2.4 version configuration file
We alse add an --apache-version option to force the version in case
detection would be wrong.
Closes Bug: #1438773
Change-Id: I7d28c319601cf3919068be4ac52dd10f58a82557
This command allows to easily save a diff between local_settings.py and
local_settings.py.example to reapply the change when local_settings.py.example
changes (per branch switch or updates).
implements bp settings-migration-script
Change-Id: I2668bbf248434a5d437a5fc46ad07c1a1f29b793
The current wsgi does not support virtualenvs (in some distributions, the
dependencies may conflict with the distribution's python packages/dependencies
and would require a virtualenv even in production).
Also, making an apache web configuration is not always trivial especialy
with ssl.
This "make_web_conf" command creates a wsgi with automatic virtualenvironment
detection (if there is a virtualenvironment), and creates an apache
(normal or ssl) configuration
TODO(ygbo)::
- add nginx support to generate nginx configuration files.
- add gunicorn support.
- add uwsgi support.
implements bp web-conf-generation-script
Change-Id: I6397ba01df88b540bbdca4bf21ba90be6843022a