Merge "add header alingment for PrettyTable 3.4.0"
This commit is contained in:
commit
12fd902ada
@ -122,6 +122,10 @@ def format_dict(dct, dict_property="Property", dict_value='Value',
|
|||||||
"""
|
"""
|
||||||
pt = prettytable.PrettyTable([dict_property, dict_value])
|
pt = prettytable.PrettyTable([dict_property, dict_value])
|
||||||
pt.align = 'l'
|
pt.align = 'l'
|
||||||
|
# starting in PrettyTable 3.4.0 we need to also set the header
|
||||||
|
# as align now only applies to the data.
|
||||||
|
if hasattr(pt, 'header_align'):
|
||||||
|
pt.header_align = 'l'
|
||||||
for k, v in sorted(dct.items(), key=sort_key):
|
for k, v in sorted(dct.items(), key=sort_key):
|
||||||
# convert dict to str to check length
|
# convert dict to str to check length
|
||||||
if isinstance(v, dict):
|
if isinstance(v, dict):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user