Merge "Sort JSON output in intrinsic functions"
This commit is contained in:
commit
be1720156e
|
@ -475,7 +475,7 @@ class ReplaceJson(Replace):
|
||||||
float, bool)):
|
float, bool)):
|
||||||
if isinstance(value, (collections.Mapping, collections.Sequence)):
|
if isinstance(value, (collections.Mapping, collections.Sequence)):
|
||||||
try:
|
try:
|
||||||
return jsonutils.dumps(value, default=None)
|
return jsonutils.dumps(value, default=None, sort_keys=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise TypeError(_('"%(name)s" params must be strings, '
|
raise TypeError(_('"%(name)s" params must be strings, '
|
||||||
'numbers, list or map. '
|
'numbers, list or map. '
|
||||||
|
@ -654,7 +654,7 @@ class JoinMultiple(function.Function):
|
||||||
return s
|
return s
|
||||||
elif isinstance(s, (collections.Mapping, collections.Sequence)):
|
elif isinstance(s, (collections.Mapping, collections.Sequence)):
|
||||||
try:
|
try:
|
||||||
return jsonutils.dumps(s, default=None)
|
return jsonutils.dumps(s, default=None, sort_keys=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
msg = _('Items to join must be string, map or list. '
|
msg = _('Items to join must be string, map or list. '
|
||||||
'%s failed json serialization'
|
'%s failed json serialization'
|
||||||
|
|
Loading…
Reference in New Issue