Remove str() before exc to make sure lazy translation work

Use of str() on an lazy translation enabled message may cause
runtime failure.

Change-Id: Ib38b146ae3188241b082fb446f26ea67704797af
This commit is contained in:
Ethan Lynn 2015-03-05 11:45:43 +08:00
parent aa9a6a6de1
commit eee7d18c24
2 changed files with 3 additions and 3 deletions

View File

@ -61,7 +61,7 @@ class NestedStack(stack_resource.StackResource):
raise ValueError(_("Could not fetch remote template '%(url)s': " raise ValueError(_("Could not fetch remote template '%(url)s': "
"%(exc)s") % "%(exc)s") %
{'url': self.properties[self.TEMPLATE_URL], {'url': self.properties[self.TEMPLATE_URL],
'exc': str(r_exc)}) 'exc': r_exc})
return template_format.parse(template_data) return template_format.parse(template_data)
@ -105,7 +105,7 @@ class NestedStack(stack_resource.StackResource):
raise ValueError(_("Could not fetch remote template '%(url)s': " raise ValueError(_("Could not fetch remote template '%(url)s': "
"%(exc)s") % "%(exc)s") %
{'url': self.properties[self.TEMPLATE_URL], {'url': self.properties[self.TEMPLATE_URL],
'exc': str(r_exc)}) 'exc': r_exc})
template = template_format.parse(template_data) template = template_format.parse(template_data)

View File

@ -49,7 +49,7 @@ class VolumeExtendTask(object):
if self.clients.client_plugin('cinder').is_client_exception(ex): if self.clients.client_plugin('cinder').is_client_exception(ex):
raise exception.Error(_( raise exception.Error(_(
"Failed to extend volume %(vol)s - %(err)s") % { "Failed to extend volume %(vol)s - %(err)s") % {
'vol': vol.id, 'err': str(ex)}) 'vol': vol.id, 'err': ex})
else: else:
raise raise