Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15237 - main/branches/2.1.7/pym/portage
Date: Fri, 29 Jan 2010 18:45:57
Message-Id: E1Navqn-00064Z-Hj@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-01-29 18:45:49 +0000 (Fri, 29 Jan 2010)
3 New Revision: 15237
4
5 Modified:
6 main/branches/2.1.7/pym/portage/exception.py
7 Log:
8 In python-2.x, convert PortageException.value attribute from unicode to str
9 in order to avoid empty output with string format operator. (trunk r15169)
10
11 Modified: main/branches/2.1.7/pym/portage/exception.py
12 ===================================================================
13 --- main/branches/2.1.7/pym/portage/exception.py 2010-01-29 18:45:41 UTC (rev 15236)
14 +++ main/branches/2.1.7/pym/portage/exception.py 2010-01-29 18:45:49 UTC (rev 15237)
15 @@ -3,6 +3,7 @@
16 # $Id$
17
18 import sys
19 +from portage import _unicode_encode
20 from portage.localization import _
21
22 if sys.hexversion >= 0x3000000:
23 @@ -12,6 +13,10 @@
24 """General superclass for portage exceptions"""
25 def __init__(self,value):
26 self.value = value[:]
27 + if sys.hexversion < 0x3000000 and isinstance(self.value, unicode):
28 + # Workaround for string formatting operator and unicode value
29 + # attribute triggering empty output in formatted string.
30 + self.value = _unicode_encode(self.value)
31 def __str__(self):
32 if isinstance(self.value, basestring):
33 return self.value