summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hellmann <doug.hellmann@dreamhost.com>2012-05-04 13:28:26 -0400
committerDoug Hellmann <doug.hellmann@dreamhost.com>2012-05-04 13:28:26 -0400
commitf257e91f50e63eef5598bc37867744d0efb1250f (patch)
treef2e929f59312d177df8497e38a8e182c5373c965
parent78e83c545a998d16ecd8eace04d4da978f389074 (diff)
downloadcliff-tablib-f257e91f50e63eef5598bc37867744d0efb1250f.tar.gz
changes in the prettytable API rolled into the python 3 support update
-rw-r--r--cliff/formatters/table.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cliff/formatters/table.py b/cliff/formatters/table.py
index 298c5f7..690ae30 100644
--- a/cliff/formatters/table.py
+++ b/cliff/formatters/table.py
@@ -34,7 +34,7 @@ class TableFormatter(ListFormatter, SingleFormatter):
def emit_list(self, column_names, data, stdout, parsed_args):
x = prettytable.PrettyTable(column_names)
- x.set_padding_width(1)
+ x.padding_width = 1
# Figure out the types of the columns in the
# first row and set the alignment of the
# output accordingly.
@@ -46,7 +46,7 @@ class TableFormatter(ListFormatter, SingleFormatter):
else:
for value, name in zip(first_row, column_names):
alignment = self.ALIGNMENTS.get(type(value), 'l')
- x.set_field_align(name, alignment)
+ x.align[name] = alignment
# Now iterate over the data and add the rows.
x.add_row(first_row)
for row in data_iter:
@@ -57,12 +57,12 @@ class TableFormatter(ListFormatter, SingleFormatter):
return
def emit_one(self, column_names, data, stdout, parsed_args):
- x = prettytable.PrettyTable(('Field', 'Value'))
- x.set_padding_width(1)
+ x = prettytable.PrettyTable(field_names=('Field', 'Value'))
+ x.padding_width = 1
# Align all columns left because the values are
# not all the same type.
- x.set_field_align('Field', 'l')
- x.set_field_align('Value', 'l')
+ x.align['Field'] = 'l'
+ x.align['Value'] = 'l'
desired_columns = parsed_args.columns
for name, value in zip(column_names, data):
if name in desired_columns or not desired_columns: