From: Zac Medico Date: Thu, 25 Mar 2010 11:07:38 +0000 (-0700) Subject: Implement PortageException.__unicode__ so the string formatin operator will X-Git-Tag: v2.2_rc68~691 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7a3dfc630b82dc8becc1df0ca160b3f5a6708974;p=portage.git Implement PortageException.__unicode__ so the string formatin operator will work correctly with unicode strings in python2. --- diff --git a/pym/portage/exception.py b/pym/portage/exception.py index 39901ed07..f8388e2b6 100644 --- a/pym/portage/exception.py +++ b/pym/portage/exception.py @@ -2,7 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 import sys -from portage import _unicode_encode +from portage import _unicode_encode, _unicode_decode from portage.localization import _ if sys.hexversion >= 0x3000000: @@ -22,6 +22,10 @@ class PortageException(Exception): else: return repr(self.value) + if sys.hexversion < 0x3000000: + def __unicode__(self): + return _unicode_decode(self.__str__()) + class CorruptionError(PortageException): """Corruption indication"""