Message207721
xml.etree.ElementTree.ElementTree.write method (and, as a derivative, xml.etree.ElementTree.tostring function) sorts attributes in lexical order. while an admissible behavior instead of the randomness inherited from ordinary dict, this prevents a picky user to have her own custom ordering by passing an OrderedDict to Element, SubElement and the like (i guess there are none). that is to say:
if
-----------------------------------
e = Element("tag", OrderedDict([("a", "a"), ("c", "c"), ("b", "b")]))
-----------------------------------
then both
-----------------------------------
tostring(e)
ElementTree(e).write("xml.xml")
-----------------------------------
will result in
-----------------------------------
<tag a="a" b="b" c="c" />
-----------------------------------
while the intention of the user was
-----------------------------------
<tag a="a" c="c" b="b" /> |
|
Date |
User |
Action |
Args |
2014-01-09 01:35:08 | bagratte | set | recipients:
+ bagratte |
2014-01-09 01:35:08 | bagratte | set | messageid: <1389231308.67.0.0933451284696.issue20198@psf.upfronthosting.co.za> |
2014-01-09 01:35:08 | bagratte | link | issue20198 messages |
2014-01-09 01:35:06 | bagratte | create | |
|