mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
Ensure that item fields have the proper type.
The item fields were not setting their type based on the reported field's type attribute, so values were not being encoded properly. Fixes issue #121
This commit is contained in:
parent
fc8a13df5a
commit
9c6dde5d22
1 changed files with 3 additions and 3 deletions
|
@ -96,11 +96,11 @@ class Form(ElementBase):
|
||||||
self.xml.append(itemXML)
|
self.xml.append(itemXML)
|
||||||
reported_vars = self['reported'].keys()
|
reported_vars = self['reported'].keys()
|
||||||
for var in reported_vars:
|
for var in reported_vars:
|
||||||
fieldXML = ET.Element('{%s}field' % FormField.namespace)
|
field = FormField()
|
||||||
itemXML.append(fieldXML)
|
field._type = self['reported'][var]['type']
|
||||||
field = FormField(xml=fieldXML)
|
|
||||||
field['var'] = var
|
field['var'] = var
|
||||||
field['value'] = values.get(var, None)
|
field['value'] = values.get(var, None)
|
||||||
|
itemXML.append(field.xml)
|
||||||
|
|
||||||
def add_reported(self, var, ftype=None, label='', desc='', **kwargs):
|
def add_reported(self, var, ftype=None, label='', desc='', **kwargs):
|
||||||
kwtype = kwargs.get('type', None)
|
kwtype = kwargs.get('type', None)
|
||||||
|
|
Loading…
Reference in a new issue