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: Iabde2f7d6a98115c0bf7d3ef097bafb0a13d6cbe
This commit is contained in:
Luong Anh Tuan 2016-09-28 16:05:43 +07:00 committed by Tuan Luong-Anh
parent 9ab092652e
commit a6f34dd1af
3 changed files with 13 additions and 13 deletions

View File

@ -453,7 +453,7 @@ class Resource(object):
self._add_event(self.action, self.status,
_("%(a)s paused until Hook %(h)s is cleared")
% {'a': action, 'h': hook})
LOG.info(_LI('Reached hook on %s'), six.text_type(self))
LOG.info(_LI('Reached hook on %s'), self)
while self.has_hook(hook) and self.status != self.FAILED:
try:
@ -910,7 +910,7 @@ class Resource(object):
yield self._break_if_required(
self.CREATE, environment.HOOK_PRE_CREATE)
LOG.info(_LI('creating %s'), six.text_type(self))
LOG.info(_LI('creating %s'), self)
# Re-resolve the template, since if the resource Ref's
# the StackId pseudo parameter, it will change after
@ -1226,7 +1226,7 @@ class Resource(object):
except Exception as ex:
LOG.warning(_LW("Resource cannot be updated with it's "
"live state in case of next "
"error: %s"), six.text_type(ex))
"error: %s"), ex)
return after_props, before_props
def _prepare_update_replace(self, action):
@ -1307,7 +1307,7 @@ class Resource(object):
exc = Exception(_('Resource update already requested'))
raise exception.ResourceFailure(exc, self, action)
LOG.info(_LI('updating %s'), six.text_type(self))
LOG.info(_LI('updating %s'), self)
self.updated_time = datetime.utcnow()
@ -1369,7 +1369,7 @@ class Resource(object):
original state with the added message that check was not performed.
"""
action = self.CHECK
LOG.info(_LI('Checking %s'), six.text_type(self))
LOG.info(_LI('Checking %s'), self)
if hasattr(self, 'handle_%s' % action.lower()):
return self._do_action(action)
@ -1410,7 +1410,7 @@ class Resource(object):
% six.text_type(self.state))
raise exception.ResourceFailure(exc, self, action)
LOG.info(_LI('suspending %s'), six.text_type(self))
LOG.info(_LI('suspending %s'), self)
return self._do_action(action)
def resume(self):
@ -1429,12 +1429,12 @@ class Resource(object):
exc = exception.Error(_('State %s invalid for resume')
% six.text_type(self.state))
raise exception.ResourceFailure(exc, self, action)
LOG.info(_LI('resuming %s'), six.text_type(self))
LOG.info(_LI('resuming %s'), self)
return self._do_action(action)
def snapshot(self):
"""Snapshot the resource and return the created data, if any."""
LOG.info(_LI('snapshotting %s'), six.text_type(self))
LOG.info(_LI('snapshotting %s'), self)
return self._do_action(self.SNAPSHOT)
@scheduler.wrappertask
@ -1484,7 +1484,7 @@ class Resource(object):
This may be overridden by resource plugins to add extra
validation logic specific to the resource implementation.
"""
LOG.info(_LI('Validating %s'), six.text_type(self))
LOG.info(_LI('Validating %s'), self)
return self.validate_template()
def validate_template(self):
@ -1631,7 +1631,7 @@ class Resource(object):
yield self._break_if_required(
self.DELETE, environment.HOOK_PRE_DELETE)
LOG.info(_LI('deleting %s'), six.text_type(self))
LOG.info(_LI('deleting %s'), self)
if self._stored_properties_data is not None:
# On delete we can't rely on re-resolving the properties

View File

@ -207,7 +207,7 @@ class TaskRunner(object):
return False
if self._timeout is not None and self._timeout.expired():
LOG.info(_LI('%s timed out'), six.text_type(self))
LOG.info(_LI('%s timed out'), self)
self._done = True
self._timeout.trigger(self._runner)

View File

@ -1825,7 +1825,7 @@ class Stack(collections.Mapping):
"""
# No need to suspend if the stack has been suspended
if self.state == (self.SUSPEND, self.COMPLETE):
LOG.info(_LI('%s is already suspended'), six.text_type(self))
LOG.info(_LI('%s is already suspended'), self)
return
self.updated_time = oslo_timeutils.utcnow()
@ -1850,7 +1850,7 @@ class Stack(collections.Mapping):
"""
# No need to resume if the stack has been resumed
if self.state == (self.RESUME, self.COMPLETE):
LOG.info(_LI('%s is already resumed'), six.text_type(self))
LOG.info(_LI('%s is already resumed'), self)
return
self.updated_time = oslo_timeutils.utcnow()