Fix table formatter with 0.6 version

I didn't see a way to only align header...
This commit is contained in:
Florent 2012-05-21 17:46:21 +02:00
commit bad531679a

View file

@ -69,7 +69,13 @@ class TableFormatter(IFormatter):
s += "\n"
table = PrettyTable(list(column_headers))
for column_header in column_headers:
table.set_field_align(column_header, 'l')
# API changed in python-prettytable. The try/except is a bad hack to support both versions
# Note: two versions are not exactly the same...
# (first one: header in center. Second one: left align for header too)
try:
table.set_field_align(column_header, 'l')
except:
table.align[column_header] = 'l'
for line in queue:
table.add_row(line)