From d057d6c2464eae9afd8a4a484cbdc31f2ea9a3fa Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 29 Apr 2013 11:28:39 +0200 Subject: [PATCH] Restore compatibility with PrettyTable < 0.7.2 PrettyTable 0.7.2 defaults to print a table even if the resultset is empty. Restore previous behavior to be in line with older prettytable releases. Change-Id: Iaa9e1cf5444c8daa229aad53e3a3c15038a7d57e --- heatclient/common/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/heatclient/common/utils.py b/heatclient/common/utils.py index 3052d687..c0f34394 100644 --- a/heatclient/common/utils.py +++ b/heatclient/common/utils.py @@ -41,7 +41,8 @@ def pretty_choice_list(l): def print_list(objs, fields, field_labels=None, formatters={}, sortby=0): field_labels = field_labels or fields - pt = prettytable.PrettyTable([f for f in field_labels], caching=False) + pt = prettytable.PrettyTable([f for f in field_labels], + caching=False, print_empty=False) pt.align = 'l' for o in objs: @@ -57,7 +58,8 @@ def print_list(objs, fields, field_labels=None, formatters={}, sortby=0): def print_dict(d, formatters={}): - pt = prettytable.PrettyTable(['Property', 'Value'], caching=False) + pt = prettytable.PrettyTable(['Property', 'Value'], + caching=False, print_empty=False) pt.align = 'l' for field in d.keys():