misc: sort dictionary keys when exporting to xml (#36515)
This commit is contained in:
parent
82fd9489bf
commit
478ff982a1
|
@ -240,7 +240,7 @@ class Field(object):
|
|||
continue
|
||||
el = ET.SubElement(field, attribute)
|
||||
if type(val) is dict:
|
||||
for k, v in val.items():
|
||||
for k, v in sorted(val.items()):
|
||||
if isinstance(v, str):
|
||||
text_value = force_text(v, charset, errors='replace')
|
||||
else:
|
||||
|
|
|
@ -959,7 +959,7 @@ class FormDef(StorableObject):
|
|||
sub.text = role
|
||||
|
||||
options = ET.SubElement(root, 'options')
|
||||
for option in self.workflow_options or []:
|
||||
for option in sorted(self.workflow_options or []):
|
||||
element = ET.SubElement(options, 'option')
|
||||
element.attrib['varname'] = option
|
||||
option_value = self.workflow_options.get(option)
|
||||
|
|
|
@ -528,7 +528,7 @@ class Workflow(StorableObject):
|
|||
|
||||
roles_node = ET.SubElement(root, 'roles')
|
||||
if self.roles:
|
||||
for role_id, role_label in self.roles.items():
|
||||
for role_id, role_label in sorted(self.roles.items()):
|
||||
role_node = ET.SubElement(roles_node, 'role')
|
||||
role_node.attrib['id'] = role_id
|
||||
role_node.text = force_text(role_label, charset)
|
||||
|
|
Loading…
Reference in New Issue