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:
		| @@ -41,7 +41,8 @@ def pretty_choice_list(l): | |||||||
|  |  | ||||||
|  |  | ||||||
| def print_list(objs, fields, field_labels, formatters={}, sortby=0): | 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' |     pt.align = 'l' | ||||||
|  |  | ||||||
|     for o in objs: |     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): | 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' |     pt.align = 'l' | ||||||
|     for k, v in d.iteritems(): |     for k, v in d.iteritems(): | ||||||
|         # convert dict to str to check length |         # convert dict to str to check length | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Dirk Mueller
					Dirk Mueller