We have two imports with #noqa: django.conf.urls.patterns and
django.conf.urls.url however using them is a standard way of creating
any urls.py module. So there are over 150 imports in Horizon code
where #noqa could be replaced with two lines in list of import_exceptions.
Change-Id: I81c3290e0dc958b5037dd6a87e44df18adfbe751
Currently BatchAction proposes only an action_present and action_past verb
to be concatenated with a data_type_singular or data_type_plural string.
The issue is that many languages need to conjugate the verb with the
plural/singular subject, and some translations where terribly awfull and
impossible to do.
Indeed, some languages have up to 5 plural forms depending on the number of
items.
This patch introduces the fact that action_present is a method instead of an
attribute, which in conjonction with https://review.openstack.org/57701 allows
better translation to be performed.
This patch also adds contextual mrkers to STATUS_DISPLAY_CHOICES,
TASK_DISPLAY_CHOICES and POWER_DISPLAY_CHOICES because it was impossible to
translate the stand-alone words out of context for a translator (i.e. the word
"active" will be translated differently if the active object is feminine or
masculine, since feminine and masculine depends also on the language, it is
mission impossible for the translator to translate "active" if he does not know
"what" is "active").
It is important to use unicode strings with contextual markers because of the
following django bug:
https://code.djangoproject.com/ticket/22565
The django community was very quick and responsive and fixed the bug very fast:
https://code.djangoproject.com/changeset/142c27218a0bb07bb197faab7b1d8eb3a084f5b9
and back-ported their fix in the 1.6 and 1.7 django branches:
https://code.djangoproject.com/changeset/61fd00d4fd65f44d0a05be4c7e95124e4102ec27https://code.djangoproject.com/changeset/034866204b39f797c73997b03cd90443aa03aa91
but since in horizon we support back to django 1.4, we will have to live with
it by providing unicode strings until we drop support of old django versions.
We can't introduce contextual markers and ungettext (pluralization) verywhere
at once because Translators would totally loose their previous work. So we have
to progressively introduce contextual markers and pluralization, when a string
is changed, or for new strings. It is also the reason why this patch changes
only the strings of the instance view actions.
Since we can't use contextual markers and pluralization for all the code at
once, this patch partially:
partial-bug: 1307476
Change-Id: I4cef42dc4a12f55cf750d9a18083254c6a96e716
In Horizon "_" (ugettext_lazy) is defined by usual imports,
so "builtins = _" in tox.ini is unnecessary.
Change-Id: I2d429f5a4783f8da44739da7fe3ba1d6c76f4146
Django changed the name to force_unicode and it's only available in
python2 as an alias of force_text. The new name is available since
Django 1.4.2
Closes-Bug: #1345642
Change-Id: Ida8c545ceec7c31999f2497d540a0dc5a653d286
New tox (>=1.7.0) sets a random python hash seed by default. This is
generally good for testing because it will help keep projects working
regardless of the hash seed, but nova unittests don't currently pass
with a random hash seed so set it to the python default seed.
This change will allow us to use new tox again and remove the
restriction on tox<=1.6.1 to run unittests.
Also see Ib54364877a251db48c54dfdc43c503281ea1f04a.
Change-Id: I8834487e8c7bcdbeae8397c1a10a18873976ce61
Partial-Bug: #1348818
Enable hacking rule H702 Formatting operation should
be outside of localization method call.
This rule is useful to avoid untranslated strings.
Change-Id: I1c32707ed418c1e64cce24b0adceee14af16200c
This is the final fix to re-enable flake8/pep8 check in the gate.
E265 errors in doc/source/conf.py are also fixed.
Imports with "from xxxx import (xxxx)" style cannot pass "tox -e pep8"
though they pass "run_tests.sh -p". Newlines with backslash escape
is used in this commit to pass it.
The reason needs to be investigated later.
Change-Id: Ic0d765d404212d13f678b2a3aef7b9612bf5238d
Closes-Bug: #1347472
This is incorrect and should never have been added. The order of
lines in requirements files affects the pip dependency resolver.
Therefore, while it's nice to add new packages in alphabetical
order, it must not be required.
Move pbr to the top of the list as it should always be installed
first. Move hacking to the top of the test-requires list.
Change-Id: I81f7e75b77baccd12d9660dc009f30f2f2c891bc
Added nodeenv as a test requirement.
Added a jshint environment to tox.ini, which installs node.js into the
python virtual environment with nodeenv, installs jshint using npm,
and calls runtest.sh to run the tests.
runtest.sh now supports the -j|--jshint flags to run jshint on the
javascript files. jshint must be installed before running runtest.sh
The documentation also got updated to include some info about jshint.
This patch does not add jshint to the OpenStack codebase, just provides
a way to install it for testing, to avoid license clash (jshint has a
slightly modified MIT license, which is incompatible with OpenStack's
Apache license).
Change-Id: I9dd0743eaee50fdba3dbb527c29f2501bdd44ca6
Implements: blueprint node-toolchain
Implements: blueprint jshint-codestyle
When building the documentation via run_tests.sh, doc/source/conf.py
explicitly sets the DJANGO_SETTINGS_MODULE environment variable,
overriding any existing value that it already has. Furthermore, it sets
it to point to a settings file that does not use keystone v3, which
is expected by the tests (and is the source of the warning). Note that
when running unit tests via run_tests.sh, a different settings file is
supplied which DOES use keystone v3.
Change the doc/source/conf.py to only set DJANGO_SETTINGS_MODULE if it
is not already set. Change tox.ini and run_tests.sh to set
DJANGO_SETTINGS_MODULE to the same settings file used by the unit tests,
with keystone v3 support.
Change-Id: Ib297e4188f2426cf575300998bc9d50f36e48f4f
Closes-Bug: #1257725
According to http://docs.openstack.org/developer/hacking/ it should
be preferred to use six.add_metaclass instead of __metaclass__.
Change-Id: Iec6550421bcf54f30952d9dc9f3a398288d6a283
This change allows extension plugins to make use of AngularJS without
changing horizon template or javascript files.
Horizon bootstraps AngularJS once when a page loads with a list
of modules. An extension can register a list of modules and a list
of javascript files that contain these modules.
Implements blueprint: plugins-angular
Change-Id: I4a76363dd4a631cc0d2fc2c902c2f5cac0f073f2
When testing with tox we currently cannot test a specific file, it
is due to the fact that tox does not pass the arguments to nose.
By adding {posargs} at the end of the tox target which are using
nose, we can now use all of its features
Change-Id: If59830669fabb704cb9b6348819c6cec4060088a
Closes-Bug: #1306016
Co-Authored-By: florent <florent.flament-ext@cloudwatt.com>
In django-based projects, we need to specify DJANGO_SETTINGS_MODULE
when running docs build. It is required to addresses the warnings of
docs build job in the gate.
This commit also changes run_tests.sh --docs to use "python setup.py
build_sphinx" to match tox docs env. This change addresses all sphinx
build warning except keystone v3 related following warning.
I believe it is useful.
NoReverseMatch: u'domains' is not a registered namespace
inside 'horizon:admin'
Closes-Bug: #1302532
Related-Bug: #1257725
Change-Id: I3663b81b58be3c6cb05e4af914f768c28b21ea07
In python 3 print statement is not supported, so we should use
only print() functions.
Fixes bug 1226943
Change-Id: I721e67c917ba7018401ad40ef30081883dcec420
This makes code more readable, and can check whether specific library
in the requirement files easily. We enforce the check in pep8, We also
add the tools for checking requirements.txt and test_requirements.txt.
Change-Id: Ia0a24553b7a5204faf6413c17dae6ba6aae2b5e8
Closes-Bug: #1285478
Initial setup for running the integration tests. A basic test is
included to ensure this works, although it will be rewritten to follow
the Page Object pattern. Thanks to Daniel Korn for the initial test.
https://wiki.openstack.org/wiki/Horizon/Testing/UI
Implements blueprint: selenium-integration-testing
Change-Id: Id5b62cdeac5295667a3922f7bed1db3c7617f841
This patch set removes leftovers of "# noqa" from imports
added to import_exceptions.
It also adds "django.test.utils.override_settings" to
import_exceptions, so a few more "# noqa" tags become
unnecessary.
Closes-Bug: #1273647
Change-Id: I39f856ac3ea371a2fcab272bbf358d0243164b6d
We have a lot of import with #noqa that is there to ignore h302,
because it's traditional to import and use a name directly, instead
of a whole module. This hides other errors and gives people the
impression that it's actually fine to import non-modules, you just
have to slap #noqa on those lines.
I went through the code and identified about a dozen names that are
most commonly imported this way. I remove the #noqa tag from them,
and added them to the list in import_exceptions.
I also removed a few unused imports that were revealed in the process.
Change-Id: I27afb8e2b1d4759ec974ded9464d8f010312ee78
* tox.ini(testenv.install_command): Use the --allow-external and
--allow-insecure options so that pip 1.5 and later will assent to
retrieve the netaddr package even though it's not hosted on PyPI.
The --allow-insecure option is aliased to a clearer
--allow-unverified wording in 1.5, but the old form is being used to
avoid breaking users of 1.4.x and will be valid at least through
1.6.x according to comments in the pip source.
Change-Id: I291684fa65279f0cb86f84e0d8e69bfa4b4087c0
Partial-Bug: #1266513
Reasons:
- tox update v1.6
Changes:
- tox 1.6 allows us to skip the sdist step, which is slow.
- It also allows us to override the install line. In this case, it's
important as it allows us to stop getting pre-release software we
weren't asking for.
Original patch by Monty Taylor, talked about here:
http://lists.openstack.org/pipermail/openstack-dev/2013-September/015495.html
Change-Id: I0b2da3369ec303b9997305f602e6c444cafe14b0
In an effort to help horizon more friendly to OpenStack hacking
guidelines, we now gate on H40* violations.
Change-Id: Id07294543660368d2f7f5ac363710176ab23b874
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
Now all files are properly licensed per OpenStack Hacking.
Change-Id: I223d983018568357197b0d9cf5dde12c135c53c9
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
H803: Git commit title should not end with period.
I don't think we really care whether a commit title ends with a period
or not. Certainly not enough to warrant patches failing checks and
wasting people's time and CI resources.
Change-Id: I52fd73c35545943b1a7e2cec62ddb52a5f90a24b
Closes-bug: 1236621.
* F403 has already been fix in https://review.openstack.org/#/c/38435/.
* This patch fixes the remaining F999 issue.
Change-Id: Id484a577973bb56168b6d85a5fc909a471e1128c
This patch replaces some method imports with module imports and
makes H302 test enabled.
Fixes bug 1188531
Change-Id: Ibfbddeaa19cbbb244da58ffd5c918c41f03a0c65
Fixes all occurrences of this. We have a custom exception handler
in Horizon anyway that only catches ClientException in most of these
cases, but this commit lets us gate on the other cases.
Change-Id: Iea3dc13817f3e5b775b2024424bf3a906da5584b
Closes-Bug: #1211657
This is talked in bug #1188533, and in current codes, there are several
places here:
horizon/forms/__init__.py:18:from django.forms import *
mark '# noqa'
openstack_dashboard/settings.py:182: from local.local_settings import *
openstack_dashboard/test/settings.py:5:from horizon.test.settings import *
mark '# noqa'
openstack_dashboard/dashboards/project/instances/workflows/__init__.py:1:from create_instance import *
openstack_dashboard/dashboards/project/instances/workflows/__init__.py:2:from update_instance import *
openstack_dashboard/dashboards/project/instances/workflows/__init__.py:3:from resize_instance import *
fix it
openstack_dashboard/dashboards/project/images_and_snapshots/urls.py:21:from django.conf.urls.defaults import *
fix it
fixes bug # 1188533
Change-Id: Id671280903f8452a78f81f1240d92297de7a89a8
This check looks to see whether a local variable
is unused. Also fixed all violators of said check.
Change-Id: I7c186df41b5601078ffc54588aace8136c6576bd
This patch replaces relative imports with full paths and
makes H304 test enabled.
Fixes bug 1188535
Change-Id: I47254cf9a790727102f7993d0fd107da514983df