diff options
author | Lance Stout <lancestout@gmail.com> | 2011-12-13 08:59:39 -0800 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-12-13 08:59:39 -0800 |
commit | 9c6dde5d22badadb318ca8f340b592c63944c975 (patch) | |
tree | defa7c85388c514880fec6af0c5346ecd6d129ea /sleekxmpp/plugins/xep_0004/stanza/form.py | |
parent | fc8a13df5a76176eb843ee0c4c4d4da462d3ab3b (diff) | |
download | slixmpp-9c6dde5d22badadb318ca8f340b592c63944c975.tar.gz slixmpp-9c6dde5d22badadb318ca8f340b592c63944c975.tar.bz2 slixmpp-9c6dde5d22badadb318ca8f340b592c63944c975.tar.xz slixmpp-9c6dde5d22badadb318ca8f340b592c63944c975.zip |
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
Diffstat (limited to 'sleekxmpp/plugins/xep_0004/stanza/form.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0004/stanza/form.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0004/stanza/form.py b/sleekxmpp/plugins/xep_0004/stanza/form.py index 993f7b12..1fcd707f 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) |