Restore compatibility with PrettyTable < 0.7.2

PrettyTable 0.7.2 changed the default to print
also tables when the result set is empty. Revert
to previous default.

Change-Id: I22ab7522227ef70929d31dd2c4aaff93c4c518c2
This commit is contained in:
Dirk Mueller
2013-04-29 11:19:13 +02:00
parent 2bcc72c485
commit 888d63aaa0

View File

@@ -41,7 +41,8 @@ def pretty_choice_list(l):
def print_list(objs, fields, field_labels, formatters={}, sortby=0):
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, formatters={}, sortby=0):
def print_dict(d, dict_property="Property", wrap=0):
pt = prettytable.PrettyTable([dict_property, 'Value'], caching=False)
pt = prettytable.PrettyTable([dict_property, 'Value'],
caching=False, print_empty=False)
pt.align = 'l'
for k, v in d.iteritems():
# convert dict to str to check length