Revision 5a5a1f65
b/snf-cyclades-app/synnefo/management/common.py | ||
---|---|---|
49 | 49 |
from synnefo.logic.rapi import GanetiApiError, GanetiRapiClient |
50 | 50 |
from synnefo.lib import astakos |
51 | 51 |
|
52 |
from synnefo.util.text import uenc |
|
53 |
|
|
52 | 54 |
import logging |
53 | 55 |
log = logging.getLogger(__name__) |
54 | 56 |
|
... | ... | |
231 | 233 |
table.insert(0, headers) |
232 | 234 |
|
233 | 235 |
# Find out the max width of each column |
234 |
widths = [max(map(len, str(col))) for col in zip(*table)]
|
|
236 |
widths = [max(map(len, col)) for col in zip(*table)]
|
|
235 | 237 |
|
236 | 238 |
t_length = sum(widths) + len(sep) * (len(widths) - 1) |
237 | 239 |
if headers: |
... | ... | |
244 | 246 |
|
245 | 247 |
# print the rest table |
246 | 248 |
for row in table: |
247 |
print >> out, sep.join((str(val).rjust(width).encode('utf8')
|
|
248 |
for val, width in zip(row, widths)))
|
|
249 |
print >> out, sep.join(uenc(val.rjust(width))
|
|
250 |
for val, width in zip(row, widths)) |
|
249 | 251 |
|
250 | 252 |
|
251 | 253 |
class UserCache(object): |
Also available in: Unified diff