Fixing policy sorting for Python 3

This commit is contained in:
mechaxl 2017-05-31 13:06:31 -05:00 committed by Toshio Kuratomi
parent c1f0260ae3
commit 3c3e9c3b36

View file

@ -570,7 +570,9 @@ def sort_json_policy_dict(policy_dict):
else: else:
checked_list.append(item) checked_list.append(item)
checked_list.sort() # Sort list. If it's a list of dictionaries, sort by tuple of key-value
# pairs, since Python 3 doesn't allow comparisons such as `<` between dictionaries.
checked_list.sort(key=lambda x: sorted(x.items()) if isinstance(x, dict) else x)
return checked_list return checked_list
ordered_policy_dict = {} ordered_policy_dict = {}