From 2732fe098a08c93956ff40aed9dd1db5e01eb009 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 29 Apr 2013 11:22:04 +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: Idd1d0c2c2f41966076517cbc8819ba9a5e097306 --- keystoneclient/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/keystoneclient/utils.py b/keystoneclient/utils.py index 3d708ca1a..fedc234b6 100644 --- a/keystoneclient/utils.py +++ b/keystoneclient/utils.py @@ -21,7 +21,8 @@ def pretty_choice_list(l): def print_list(objs, fields, formatters={}, order_by=None): - pt = prettytable.PrettyTable([f for f in fields], caching=False) + pt = prettytable.PrettyTable([f for f in fields], + caching=False, print_empty=False) pt.aligns = ['l' for f in fields] for o in objs: @@ -55,7 +56,8 @@ def print_dict(d, wrap=0): Wrap values to max_length wrap if wrap>0 """ - pt = prettytable.PrettyTable(['Property', 'Value'], caching=False) + pt = prettytable.PrettyTable(['Property', 'Value'], + caching=False, print_empty=False) pt.aligns = ['l', 'l'] for (prop, value) in d.iteritems(): if value is None: