summaryrefslogtreecommitdiffstats
path: root/pym/portage/exception.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-01-05 19:15:39 +0000
committerZac Medico <zmedico@gentoo.org>2010-01-05 19:15:39 +0000
commitd0319df3fbc5c2eb0d04b17cfba35a3e0c661cbc (patch)
treec426ad320448cfbd9fe213ed9bd39ce246792755 /pym/portage/exception.py
parentb815dd042bf625313a4a45724d9213260d30870d (diff)
downloadportage-d0319df3fbc5c2eb0d04b17cfba35a3e0c661cbc.tar.gz
portage-d0319df3fbc5c2eb0d04b17cfba35a3e0c661cbc.tar.bz2
portage-d0319df3fbc5c2eb0d04b17cfba35a3e0c661cbc.zip
In python-2.x, convert PortageException.value attribute from unicode to str
in order to avoid empty output with string format operator. svn path=/main/trunk/; revision=15169
Diffstat (limited to 'pym/portage/exception.py')
-rw-r--r--pym/portage/exception.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pym/portage/exception.py b/pym/portage/exception.py
index 85efc2767..900dab7df 100644
--- a/pym/portage/exception.py
+++ b/pym/portage/exception.py
@@ -3,6 +3,7 @@
# $Id$
import sys
+from portage import _unicode_encode
from portage.localization import _
if sys.hexversion >= 0x3000000:
@@ -12,6 +13,10 @@ class PortageException(Exception):
"""General superclass for portage exceptions"""
def __init__(self,value):
self.value = value[:]
+ if sys.hexversion < 0x3000000 and isinstance(self.value, unicode):
+ # Workaround for string formatting operator and unicode value
+ # attribute triggering empty output in formatted string.
+ self.value = _unicode_encode(self.value)
def __str__(self):
if isinstance(self.value, basestring):
return self.value