summaryrefslogtreecommitdiffstats
path: root/pym/portage/exception.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-03-25 04:07:38 -0700
committerZac Medico <zmedico@gentoo.org>2010-03-25 04:07:38 -0700
commit7a3dfc630b82dc8becc1df0ca160b3f5a6708974 (patch)
treea972aab35c88e818b899d92ad21c803113ee0ede /pym/portage/exception.py
parenta95ac9ff269980f78153f4fa6a12b05d0a4c9ac4 (diff)
downloadportage-7a3dfc630b82dc8becc1df0ca160b3f5a6708974.tar.gz
portage-7a3dfc630b82dc8becc1df0ca160b3f5a6708974.tar.bz2
portage-7a3dfc630b82dc8becc1df0ca160b3f5a6708974.zip
Implement PortageException.__unicode__ so the string formatin operator will
work correctly with unicode strings in python2.
Diffstat (limited to 'pym/portage/exception.py')
-rw-r--r--pym/portage/exception.py6
1 files changed, 5 insertions, 1 deletions
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"""