Mercurial > libervia-backend
comparison src/tools/xml_tools.py @ 1500:c7c872a40e56
tools (xml_tools): keeps data form result headers sorted
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 26 Aug 2015 12:24:38 +0200 |
parents | adc72c39f032 |
children | a2e4b976e707 |
comparison
equal
deleted
inserted
replaced
1499:adc72c39f032 | 1500:c7c872a40e56 |
---|---|
25 from xml.dom import minidom, NotFoundErr | 25 from xml.dom import minidom, NotFoundErr |
26 from wokkel import data_form | 26 from wokkel import data_form |
27 from twisted.words.xish import domish | 27 from twisted.words.xish import domish |
28 from twisted.words.protocols.jabber import jid | 28 from twisted.words.protocols.jabber import jid |
29 from sat.core import exceptions | 29 from sat.core import exceptions |
30 from collections import OrderedDict | |
30 | 31 |
31 | 32 |
32 """This library help manage XML used in SàT (parameters, registration, etc)""" | 33 """This library help manage XML used in SàT (parameters, registration, etc)""" |
33 | 34 |
34 SAT_FORM_PREFIX = "SAT_FORM_" | 35 SAT_FORM_PREFIX = "SAT_FORM_" |
139 The raw data form is used because Wokkel doesn't manage result items parsing yet. | 140 The raw data form is used because Wokkel doesn't manage result items parsing yet. |
140 @param xmlui (XMLUI): the XMLUI where the AdvancedList will be added | 141 @param xmlui (XMLUI): the XMLUI where the AdvancedList will be added |
141 @param form_xml (domish.Element): element of the data form | 142 @param form_xml (domish.Element): element of the data form |
142 @return: the completed XMLUI instance | 143 @return: the completed XMLUI instance |
143 """ | 144 """ |
144 headers = {} | 145 headers = OrderedDict() |
145 try: | 146 try: |
146 reported_elt = form_xml.elements('jabber:x:data', 'reported').next() | 147 reported_elt = form_xml.elements('jabber:x:data', 'reported').next() |
147 except StopIteration: | 148 except StopIteration: |
148 raise exceptions.DataError("Couldn't find expected <reported> tag in %s" % form_xml.toXml()) | 149 raise exceptions.DataError("Couldn't find expected <reported> tag in %s" % form_xml.toXml()) |
149 | 150 |