2 Commits

Author SHA1 Message Date
Akihiro Motoki
266e6c3c3c Decode exception parameters to expand exception message properly
If a multibyte string without unicode prefix 'u' is passed to
NeutronException in python 2, string subsitution will fail.
In python 2, multibyte string without 'u' prefix is encoded into bytes.
As a result a string substitution in NeutronException.__init__ will fail.

Change-Id: I1aa08b69fe119087a7a49fda768a24f85f0e7c76
Closes-Bug: #1235228
2016-12-15 09:09:18 +00:00
Akihiro Motoki
d0e50b8b90 Use six.python_2_unicode_compatible for NeutronException.__str__
The definition of __str__ is different between py2 and py3.
__str__ should return a byte stream to make print(exc) work
in python2, but __str__ should return string type in python3.
six.python_2_unicode_compatible sets up __str__ and __unicode__
approriately.

Change-Id: I6c85ca8c4e6f86450ee390db81e3aa101293b846
Related-Bug: #1235228
2016-01-05 08:39:25 +09:00