From b2c9666a7575f6fdf30933cd08fe8143638a4b65 Mon Sep 17 00:00:00 2001 From: Luong Anh Tuan Date: Wed, 28 Sep 2016 16:11:35 +0700 Subject: [PATCH] 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 --- nova/api/openstack/__init__.py | 3 +-- nova/cmd/api.py | 3 +-- nova/network/security_group/neutron_driver.py | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nova/api/openstack/__init__.py b/nova/api/openstack/__init__.py index b2f57e7d22df..4438fb238b44 100644 --- a/nova/api/openstack/__init__.py +++ b/nova/api/openstack/__init__.py @@ -20,7 +20,6 @@ WSGI middleware for OpenStack API controllers. from oslo_log import log as logging import routes -import six import stevedore import webob.dec import webob.exc @@ -54,7 +53,7 @@ class FaultWrapper(base_wsgi.Middleware): status, webob.exc.HTTPInternalServerError)() 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) headers = getattr(inner, 'headers', None) diff --git a/nova/cmd/api.py b/nova/cmd/api.py index c127f0d22859..19e09407814d 100644 --- a/nova/cmd/api.py +++ b/nova/cmd/api.py @@ -24,7 +24,6 @@ import sys from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr -import six import nova.conf from nova import config @@ -63,7 +62,7 @@ def main(): except exception.PasteAppNotFound as ex: log.warning( _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: log.error(_LE('No APIs were started. ' diff --git a/nova/network/security_group/neutron_driver.py b/nova/network/security_group/neutron_driver.py index 21f2c76ceff0..91d5b9a598a5 100644 --- a/nova/network/security_group/neutron_driver.py +++ b/nova/network/security_group/neutron_driver.py @@ -243,7 +243,7 @@ class SecurityGroupAPI(security_group_base.SecurityGroupBase): "group %s"), name) self.raise_over_quota(six.text_type(e)) 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)) else: LOG.exception(_LE("Neutron Error:"))