public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r15237 - main/branches/2.1.7/pym/portage
@ 2010-01-29 18:45 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2010-01-29 18:45 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2010-01-29 18:45:49 +0000 (Fri, 29 Jan 2010)
New Revision: 15237

Modified:
   main/branches/2.1.7/pym/portage/exception.py
Log:
In python-2.x, convert PortageException.value attribute from unicode to str
in order to avoid empty output with string format operator. (trunk r15169)

Modified: main/branches/2.1.7/pym/portage/exception.py
===================================================================
--- main/branches/2.1.7/pym/portage/exception.py	2010-01-29 18:45:41 UTC (rev 15236)
+++ main/branches/2.1.7/pym/portage/exception.py	2010-01-29 18:45:49 UTC (rev 15237)
@@ -3,6 +3,7 @@
 # $Id$
 
 import sys
+from portage import _unicode_encode
 from portage.localization import _
 
 if sys.hexversion >= 0x3000000:
@@ -12,6 +13,10 @@
 	"""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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-29 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-29 18:45 [gentoo-commits] portage r15237 - main/branches/2.1.7/pym/portage Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox