diff options
author | Ted Ross <tross@apache.org> | 2012-07-20 16:18:23 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2012-07-20 16:18:23 +0000 |
commit | 5266d765597b3d8175e1185a85336a093330d19b (patch) | |
tree | d4e5e9fa190d9170951ba55cdcd947df8f2470c5 | |
parent | 94f078dee0a6229429777ddc607c8f5d835fe261 (diff) | |
download | qpid-python-5266d765597b3d8175e1185a85336a093330d19b.tar.gz |
QPID-4155 - Make sure decode only occurs with string values.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1363861 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | tools/src/py/qpidtoollibs/disp.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/src/py/qpidtoollibs/disp.py b/tools/src/py/qpidtoollibs/disp.py index 53e7bee267..21e09f8d00 100644 --- a/tools/src/py/qpidtoollibs/disp.py +++ b/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 |