mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 01:38:50 -03:30
cli: fix a -f human formatting bug in py2
if we encounter non-strings in JSON responses, attempt to represent them as JSON, instead of stringify-ing them (in py2, stringify-ing adds `u` markers, which is confusing to users)
This commit is contained in:
@@ -163,8 +163,8 @@ def format_human(output, fmt):
|
|||||||
try:
|
try:
|
||||||
return locale.format("%.*f", (0, int(v)), True)
|
return locale.format("%.*f", (0, int(v)), True)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
if not isinstance(v, six.text_type):
|
if isinstance(v, (list, dict)):
|
||||||
return str(v)
|
return json.dumps(v)
|
||||||
return v
|
return v
|
||||||
|
|
||||||
# calculate the max width of each column
|
# calculate the max width of each column
|
||||||
|
|||||||
Reference in New Issue
Block a user