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:
Lance Stout 2011-12-13 08:59:39 -08:00
parent fc8a13df5a
commit 9c6dde5d22

View file

@ -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)