Avoid Forcing the Translation of Translatable Variables

Translation can also be delayed for variables that potentially contain
translatable objects such as exceptions.
Whenever possible translation should not be forced by use of six.text_type()
on a message being used with a format string.
This patch allows the translation of the translatable replacement text to be
delayed until the message is translated.
http://docs.openstack.org/developer/oslo.i18n/guidelines.html#avoid-forcing-the-translation-of-translatable-variables

Change-Id: I5e259368cbf135116bb3b631835227caa1825894
This commit is contained in:
Luong Anh Tuan 2016-09-28 16:16:33 +07:00 committed by Tuan Luong-Anh
parent e80f5766a0
commit 7ce8a502c4
2 changed files with 2 additions and 3 deletions

View File

@ -511,8 +511,7 @@ class ExtensionManager(object):
LOG.debug(_('Ext namespace: %s'), extension.get_namespace())
LOG.debug(_('Ext updated: %s'), extension.get_updated())
except AttributeError as ex:
LOG.exception(_("Exception loading extension: %s"),
six.text_type(ex))
LOG.exception(_("Exception loading extension: %s"), ex)
return False
return True

View File

@ -788,7 +788,7 @@ class Resource(Application):
try:
action_result = self.dispatch(request, action, args)
except webob.exc.HTTPException as ex:
LOG.info(_("HTTP exception thrown: %s"), six.text_type(ex))
LOG.info(_("HTTP exception thrown: %s"), ex)
action_result = Fault(ex,
self._fault_body_function)
except Exception: