Fix test error caused by i18n

Now oslo i18n _() returns a Message object which doesn't support
addition, so put all the texts in _() to avoid error.

Change-Id: I32ec2359200224e6e3e550bcca1e3fdf44b3d3c3
This commit is contained in:
zhiyuan_cai 2016-05-23 16:43:22 +08:00
parent f825992ee6
commit 922b56a92d
1 changed files with 8 additions and 3 deletions

View File

@ -59,11 +59,16 @@ class TricircleException(Exception):
# log the issue and the kwargs
exc_info = _('Exception class %s in string '
'format operation') % type(self).__name__
format_str = _('%(exception_info)s ; %(format_key)s : '
'%(format_value)s')
for name, value in kwargs.items():
exc_info = exc_info + _(' ; ') + \
name + _(' : ') + six.text_type(value)
exc_info = format_str % {
'exception_info': exc_info,
'format_key': name,
'format_value': six.text_type(value)}
exc_info = self.message + _(' ; ') + exc_info
exc_info = _('%(message)s ; %(exception_info)s') % {
'message': self.message, 'exception_info': exc_info}
LOG.exception(exc_info)
# no rerasie