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
This commit is contained in:
Dirk Mueller
2013-04-29 11:28:39 +02:00
parent 9354f84e59
commit d057d6c246

View File

@@ -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():