Revision db4873f8 snf-cyclades-app/synnefo/management/common.py
b/snf-cyclades-app/synnefo/management/common.py | ||
---|---|---|
229 | 229 |
table.insert(0, headers) |
230 | 230 |
|
231 | 231 |
# Find out the max width of each column |
232 |
widths = [max(map(len, col)) for col in zip(*table)]
|
|
232 |
widths = [max(map(len, str(col))) for col in zip(*table)]
|
|
233 | 233 |
|
234 | 234 |
t_length = sum(widths) + len(sep) * (len(widths) - 1) |
235 | 235 |
if headers: |
236 | 236 |
# pretty print the headers |
237 |
print >> out, sep.join((val.rjust(width)
|
|
237 |
print >> out, sep.join((str(val).rjust(width)
|
|
238 | 238 |
for val, width in zip(headers, widths))) |
239 | 239 |
print >> out, "-" * t_length |
240 | 240 |
# remove headers |
... | ... | |
242 | 242 |
|
243 | 243 |
# print the rest table |
244 | 244 |
for row in table: |
245 |
print >> out, sep.join((val.rjust(width).encode('utf8')
|
|
245 |
print >> out, sep.join((str(val).rjust(width).encode('utf8')
|
|
246 | 246 |
for val, width in zip(row, widths))) |
247 | 247 |
|
248 | 248 |
|
Also available in: Unified diff