summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2012-07-20 16:18:23 +0000
committerTed Ross <tross@apache.org>2012-07-20 16:18:23 +0000
commit61e680e88fd1a1578fb2838085ed46c9b4f07f20 (patch)
treecd4a64fee6df63532725b4dedea6dff11de34434
parent9c85ca2f601aa118a50ebd3b3001d3700a57d62f (diff)
downloadqpid-python-61e680e88fd1a1578fb2838085ed46c9b4f07f20.tar.gz
QPID-4155 - Make sure decode only occurs with string values.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1363861 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/tools/src/py/qpidtoollibs/disp.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/qpid/tools/src/py/qpidtoollibs/disp.py b/qpid/tools/src/py/qpidtoollibs/disp.py
index 53e7bee267..21e09f8d00 100644
--- a/qpid/tools/src/py/qpidtoollibs/disp.py
+++ b/qpid/tools/src/py/qpidtoollibs/disp.py
@@ -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