From 7a3dfc630b82dc8becc1df0ca160b3f5a6708974 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 25 Mar 2010 04:07:38 -0700 Subject: Implement PortageException.__unicode__ so the string formatin operator will work correctly with unicode strings in python2. --- pym/portage/exception.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pym/portage/exception.py') 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""" -- cgit v1.2.3-1-g7c22