Add gettextutils._L* to import_exceptions

Using the new logging translation markers (_LI(), _LW(), _LE(),
_LC())[1] is problematic because they are not modules. Since the
Openstack guidelines only allow modules to be imported[2], the entire
gettextutils module must imported in order to use the translation
markers.

This patch adds all four markers to import_exceptions in tox.ini, so
they can be imported individually without failing the pep8 tests.  This
is already done with the _() marker.  With this change, it will be
allowable to import marker functions like so:

from ironic.openstack.common.gettextutils import _LI
from ironic.openstack.common.gettextutils import _LW
from ironic.openstack.common.gettextutils import _LE
from ironic.openstack.common.gettextutils import _LC

[1]http://docs.openstack.org/developer/oslo.i18n/guidelines.html
[2]http://docs.openstack.org/developer/hacking/#imports

Change-Id: I78192dd7525624174deb8d377996ed3d61b36a8a
This commit is contained in:
Ellen Hui 2014-07-03 21:44:43 +00:00
parent 5e8f7764ad
commit ca410522a7
1 changed files with 3 additions and 1 deletions

View File

@ -46,4 +46,6 @@ builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,*ironic/nova*
[hacking]
import_exceptions = ironic.openstack.common.gettextutils._,testtools.matchers
import_exceptions = ironic.openstack.common.gettextutils._, ironic.openstack.common.gettextutils._LI,
ironic.openstack.common.gettextutils._LW,ironic.openstack.common.gettextutils._LE,
ironic.openstack.common.gettextutils._LC, testtools.matchers