Mercurial > libervia-backend
comparison tools/xml_tools.py @ 37:a61beb21d16d
Gateway registration, unregistration & edition
- default values added in form
- DBus bridge: fixed array of struct management when adding dynamically a method
- fixed doc for some methods
- ugly fix for presence status
- added dependency for XEP-0077 in XEP-0100 plugin
- Wix: added unregister button in gateways manager
- Wix: added privacy warning in gateways manager
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 15 Dec 2009 01:27:32 +1100 |
parents | c45deebb40a5 |
children | 2e3411a6baad |
comparison
equal
deleted
inserted
replaced
36:6491b7956c80 | 37:a61beb21d16d |
---|---|
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 """ | 20 """ |
21 | 21 |
22 from logging import debug, info, error | 22 from logging import debug, info, error |
23 from xml.dom import minidom | 23 from xml.dom import minidom |
24 from wokkel import data_form | |
24 import pdb | 25 import pdb |
25 | 26 |
26 class XMLTools: | 27 class XMLTools: |
27 """This class help manage XML used in SàT (parameters, registration, etc) """ | 28 """This class help manage XML used in SàT (parameters, registration, etc) """ |
28 | 29 |
55 | 56 |
56 elem = doc.createElement('elem') | 57 elem = doc.createElement('elem') |
57 elem.setAttribute('name', field.var) | 58 elem.setAttribute('name', field.var) |
58 elem.setAttribute('type', __field_type) | 59 elem.setAttribute('type', __field_type) |
59 elem.setAttribute('label', field.label) | 60 elem.setAttribute('label', field.label) |
60 #text = doc.createTextNode(field.value) | 61 if field.value: |
61 #elem.appendChild(text) | 62 text = doc.createTextNode(field.value) |
63 elem.appendChild(text) | |
62 top_element.appendChild(elem) | 64 top_element.appendChild(elem) |
63 | 65 |
64 result = doc.toxml() | 66 result = doc.toxml() |
65 doc.unlink() | 67 doc.unlink() |
66 return result | 68 return result |
69 | |
70 @staticmethod | |
71 def tupleList2dataForm(values): | |
72 """convert a list of tuples (name,value) to a wokkel submit data form""" | |
73 form = data_form.Form('submit') | |
74 for value in values: | |
75 field = data_form.Field(var=value[0], value=value[1]) | |
76 form.addField(field) | |
77 | |
78 return form | |
79 | |
80 | |
81 |