Author: tross
Date: Fri Jul 20 16:18:23 2012
New Revision: 1363861

URL: http://svn.apache.org/viewvc?rev=1363861&view=rev
Log:
QPID-4155 - Make sure decode only occurs with string values.

Modified:
    qpid/trunk/qpid/tools/src/py/qpidtoollibs/disp.py

Modified: qpid/trunk/qpid/tools/src/py/qpidtoollibs/disp.py
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpidtoollibs/disp.py?rev=1363861&r1=1363860&r2=1363861&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpidtoollibs/disp.py (original)
+++ qpid/trunk/qpid/tools/src/py/qpidtoollibs/disp.py Fri Jul 20 16:18:23 2012
@@ -167,7 +167,10 @@ class Display:
     for head in heads:
       width = len (head)
       for row in rows:
-        cellWidth = len (unicode (row[col].decode('utf-8')))
+        text = row[col]
+        if text.__class__ == str:
+          text = text.decode('utf-8')
+        cellWidth = len(unicode(text))
         if cellWidth > width:
           width = cellWidth
       colWidth.append (width + self.tableSpacing)
@@ -187,9 +190,12 @@ class Display:
       line = self.tablePrefix
       col  = 0
       for width in colWidth:
-        line = line + unicode (row[col].decode('utf-8'))
+        text = row[col]
+        if text.__class__ == str:
+          text = text.decode('utf-8')
+        line = line + unicode(text)
         if col < len (heads) - 1:
-          for i in range (width - len (unicode (row[col].decode('utf-8')))):
+          for i in range (width - len(unicode(text))):
             line = line + " "
         col = col + 1
       print line



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to