summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0004/stanza
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-12-13 09:38:27 -0800
committerLance Stout <lancestout@gmail.com>2011-12-13 09:38:27 -0800
commitdcb0d8b00ec9d81f75b9b7f2cbd8fb785eafa507 (patch)
tree3a54ea344ee245318f954738a03dd573010fbd75 /sleekxmpp/plugins/xep_0004/stanza
parentcb635dcd5ab94a1cbc104788b33abefea12d0040 (diff)
parent116bb6e1b9e5c9d067b2a522d595eaa75e31be6b (diff)
downloadslixmpp-dcb0d8b00ec9d81f75b9b7f2cbd8fb785eafa507.tar.gz
slixmpp-dcb0d8b00ec9d81f75b9b7f2cbd8fb785eafa507.tar.bz2
slixmpp-dcb0d8b00ec9d81f75b9b7f2cbd8fb785eafa507.tar.xz
slixmpp-dcb0d8b00ec9d81f75b9b7f2cbd8fb785eafa507.zip
Merge branch 'develop' into develop-1.1
Diffstat (limited to 'sleekxmpp/plugins/xep_0004/stanza')
-rw-r--r--sleekxmpp/plugins/xep_0004/stanza/form.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0004/stanza/form.py b/sleekxmpp/plugins/xep_0004/stanza/form.py
index 993f7b12..bbf0ee7d 100644
--- a/sleekxmpp/plugins/xep_0004/stanza/form.py
+++ b/sleekxmpp/plugins/xep_0004/stanza/form.py
@@ -96,11 +96,11 @@ class Form(ElementBase):
self.xml.append(itemXML)
reported_vars = self['reported'].keys()
for var in reported_vars:
- fieldXML = ET.Element('{%s}field' % FormField.namespace)
- itemXML.append(fieldXML)
- field = FormField(xml=fieldXML)
+ field = FormField()
+ field._type = self['reported'][var]['type']
field['var'] = var
field['value'] = values.get(var, None)
+ itemXML.append(field.xml)
def add_reported(self, var, ftype=None, label='', desc='', **kwargs):
kwtype = kwargs.get('type', None)
@@ -159,7 +159,7 @@ class Form(ElementBase):
items = []
itemsXML = self.xml.findall('{%s}item' % self.namespace)
for itemXML in itemsXML:
- item = {}
+ item = OrderedDict()
fieldsXML = itemXML.findall('{%s}field' % FormField.namespace)
for fieldXML in fieldsXML:
field = FormField(xml=fieldXML)
@@ -168,7 +168,7 @@ class Form(ElementBase):
return items
def get_reported(self):
- fields = {}
+ fields = OrderedDict()
xml = self.xml.findall('{%s}reported/{%s}field' % (self.namespace,
FormField.namespace))
for field in xml:
@@ -177,7 +177,7 @@ class Form(ElementBase):
return fields
def get_values(self):
- values = {}
+ values = OrderedDict()
fields = self['fields']
for var in fields:
values[var] = fields[var]['value']