diff options
author | Dirk Mueller <dirk@dmllr> | 2013-05-02 12:39:20 +0200 |
---|---|---|
committer | Dirk Mueller <dirk@dmllr> | 2013-05-02 12:39:20 +0200 |
commit | d1be2d0081e33f6f7b5a533245b9d623e0285f99 (patch) | |
tree | 717bf2a43e39eda53740aa4c7439163787a0868f /cliff | |
parent | df52cc387dbc446350af717ee5a6e83cba351d92 (diff) | |
download | cliff-d1be2d0081e33f6f7b5a533245b9d623e0285f99.tar.gz |
Restore compatibility with Prettytable < 0.7.2
Starting with 0.7.2, PrettyTable changed default on how empty
tables are rendered. Before they were completely ommitted, now
the default is to show the table headers and decoration, just
no content. Restore the previous behavior to stay compatible.
Diffstat (limited to 'cliff')
-rw-r--r-- | cliff/formatters/table.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cliff/formatters/table.py b/cliff/formatters/table.py index 5b625ed..b13b364 100644 --- a/cliff/formatters/table.py +++ b/cliff/formatters/table.py @@ -22,7 +22,7 @@ class TableFormatter(ListFormatter, SingleFormatter): pass def emit_list(self, column_names, data, stdout, parsed_args): - x = prettytable.PrettyTable(column_names) + x = prettytable.PrettyTable(column_names, print_empty=False) x.padding_width = 1 # Figure out the types of the columns in the # first row and set the alignment of the @@ -46,7 +46,8 @@ class TableFormatter(ListFormatter, SingleFormatter): return def emit_one(self, column_names, data, stdout, parsed_args): - x = prettytable.PrettyTable(field_names=('Field', 'Value')) + x = prettytable.PrettyTable(field_names=('Field', 'Value'), + print_empty=False) x.padding_width = 1 # Align all columns left because the values are # not all the same type. |