Avoid Forcing the Translation of Translatable Variables

Whenever possible translation should not be forced by use of
six.text_type() on a message being used with a format string.

http://docs.openstack.org/developer/oslo.i18n/guidelines.html#avoid-forcing-the-translation-of-translatable-variables

Change-Id: I37e0ef5dce7829c3e0fa6381b8530d0e75326344
This commit is contained in:
Luong Anh Tuan 2016-09-28 16:11:35 +07:00 committed by Tuan Luong-Anh
parent de82d98333
commit b2c9666a75
3 changed files with 3 additions and 5 deletions

View File

@ -20,7 +20,6 @@ WSGI middleware for OpenStack API controllers.
from oslo_log import log as logging from oslo_log import log as logging
import routes import routes
import six
import stevedore import stevedore
import webob.dec import webob.dec
import webob.exc import webob.exc
@ -54,7 +53,7 @@ class FaultWrapper(base_wsgi.Middleware):
status, webob.exc.HTTPInternalServerError)() status, webob.exc.HTTPInternalServerError)()
def _error(self, inner, req): def _error(self, inner, req):
LOG.exception(_LE("Caught error: %s"), six.text_type(inner)) LOG.exception(_LE("Caught error: %s"), inner)
safe = getattr(inner, 'safe', False) safe = getattr(inner, 'safe', False)
headers = getattr(inner, 'headers', None) headers = getattr(inner, 'headers', None)

View File

@ -24,7 +24,6 @@ import sys
from oslo_log import log as logging from oslo_log import log as logging
from oslo_reports import guru_meditation_report as gmr from oslo_reports import guru_meditation_report as gmr
import six
import nova.conf import nova.conf
from nova import config from nova import config
@ -63,7 +62,7 @@ def main():
except exception.PasteAppNotFound as ex: except exception.PasteAppNotFound as ex:
log.warning( log.warning(
_LW("%s. ``enabled_apis`` includes bad values. " _LW("%s. ``enabled_apis`` includes bad values. "
"Fix to remove this warning."), six.text_type(ex)) "Fix to remove this warning."), ex)
if started == 0: if started == 0:
log.error(_LE('No APIs were started. ' log.error(_LE('No APIs were started. '

View File

@ -243,7 +243,7 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase):
"group %s"), name) "group %s"), name)
self.raise_over_quota(six.text_type(e)) self.raise_over_quota(six.text_type(e))
elif e.status_code == 400: elif e.status_code == 400:
LOG.exception(_LE("Neutron Error: %s"), six.text_type(e)) LOG.exception(_LE("Neutron Error: %s"), e)
self.raise_invalid_property(six.text_type(e)) self.raise_invalid_property(six.text_type(e))
else: else:
LOG.exception(_LE("Neutron Error:")) LOG.exception(_LE("Neutron Error:"))