13 Commits

Author SHA1 Message Date
ChangBo Guo(gcb)
27539859ec Remove use of contextlib.nested
The contextlib.nested call has been deprecated
in Python 2.7. This causes DeprecationWarning
messages in the unit tests.

There are also known issues with contextlib.nested
that were addressed by the native support for
multiple "with" variables. For instance, if the
first object is created but the second one throws
an exception, the first object's __exit__ is never
called. For more information see
https://docs.python.org/2/library/contextlib.html#contextlib.nested
contextlib.nested is also not compatible in Python 3.

Since Glance no longer supports 2.6 we can remove
the use of these contextlib.nested calls.

Added hacking check to catch if any new instances
are added to the codebase.

Closes-Bug: #1428424
Change-Id: Ic8edfa41d6c468cf6db8d11d3533e4f8cf2053c2
2015-03-18 20:20:33 +08:00
Pranali Deore
6eebebc80b Replace '_' with '_LI', '_LE', '_LW', '_LC'
oslo.i18n uses different marker functions to separate the
translatable messages into different catalogs, which the translation
teams can prioritize translating. For details, please refer to:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html#guidelines-for-use-in-openstack

Added hacking rules for warning, info, critical, error and exception
about checking translation for log messages and fixed for below cases only,
1. LOG.error(_(""))
2. LOG.info(_(""))
3. LOG.exception(_(""))
4. LOG.critical(_(""))
5. LOG.warning(_(""))

Below scenario is not handled in this patch,
If message is passed to LOG call using separate variable,
ex.
    msg = (_("")
    LOG.error(msg)

Change-Id: Idbf8779cdfc41ca1424bebcd101096bec482872f
2014-12-19 02:34:55 -08:00
Louis Taylor
70beb11924 Enforce using six.text_type() over unicode()
For python 3 compatibility, this adds a hacking check to prevent the
usage of unicode().

Change-Id: I791bbf251ac0f9615a9bedc2dd295a7982d72e0a
Closes-bug: #1282893
2014-09-18 09:51:04 +00:00
Chris Buccella
3994eeb862 Add hacking checks
There have been a handful of changes recently to fix stylistic bugs
in the unit tests (example: If41a7). The changes themselves were fine,
but there are two problems:

1) The stylistic changes they made were not listed in HACKING.rst
2) They were one-time changes; the rules that were violated will
   continue to be violated.

This change updates HACKING.rst to include a few of the stylistic
rules that have been fixed recently, and adds checks to ensure that
they will be enforced going forward. This is based on nova's hacking
checks.

Change-Id: Ic115342605c472f3a5d255aa570ecb60175ca087
2014-06-10 02:06:56 +00:00
Christian Berendt
86dd9ff66c debug level logs should not be translated
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.

This patch adds a new hacking check - N319 - that ensures all
debug log messages don't have translations.

Change-Id: I9dd958b904671a7eb95883026e14684469dc52d5
Closes-Bug: #1317847
2014-05-23 15:57:06 +02:00
Keshava Bharadwaj
6ea690b5c9 Cleanup and make HACKING.rst DRYer
Reference the OpenStack hacking guide in HACKING.rst and remove
duplicate entries. Adds placeholder section for glance specific
rules.

Change-Id: I1bfff8c69c9370e2d648197b7e71e229695ef627
2013-10-16 22:41:15 +05:30
Thomas Bechtold
04409386e7 Replace openstack-common with oslo in HACKING.rst
Change-Id: I211d128dce385a173cac5fec9df413b813bc4626
2013-06-10 13:48:17 +02:00
Alex Meade
acc2900429 Expand HACKING with commit message guidelines
Add a 'Commit Messages' section to HACKING describing how a commit
message should be formed.

Change-Id: I49f7c3febf65db246a84b0314597615f8d0ba247
2013-04-26 15:27:09 -04:00
Zhongyue Luo
5674da98b1 Update HACKING.rst per recent changes
Added "is not" usage with examples
Fixed "not in" usage description
* https://review.openstack.org/#/c/20877/

Change-Id: I89fbc62a8b31bc7ef750cc1e80f73b9c1e366fd3
2013-02-04 10:23:11 +08:00
Zhongyue Luo
d7be5c1982 Fixes 'not in' operator usage
Fixes bug #1111254

Change-Id: I297829049213732217332a969aa107525ac13600
2013-01-31 23:02:09 +08:00
Brian Waldon
4363af6cc8 Standardize logger instantiation
Use LOG for variable name and __name__ for logger name. Also
document this fact in HACKING.rst

Fixes bug 1015685

Change-Id: I0d9d80bef66197a28ed3d650f17859202048d776
2012-06-25 08:27:08 -07:00
Brian Waldon
8b23d4faaf Integrate openstack-common using update.py
* Update all cfg and setup imports to point to new location
* Fixes bug 987968

Change-Id: If2fbf126e0b241e80ee59fa4e43bb5af6eb879a8
2012-04-30 14:01:13 -07:00
Jay Pipes
c713c22a25 Few small cleanups to align with Nova
* Adds HACKING.rst -- with some modifications that do not apply
  to Glance
* Renames README to README.rst
* Remove old cruft with rfc.sh and BZR stuff

Change-Id: I1ff640fcee71e4d9bafa28ddd83c779ac4d702d2
2012-01-25 11:14:51 -05:00