mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-30 19:19:55 +00:00
Merge branch 'develop' into develop-1.1
This commit is contained in:
commit
dcb0d8b00e
1 changed files with 6 additions and 6 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)
|
||||||
|
@ -159,7 +159,7 @@ class Form(ElementBase):
|
||||||
items = []
|
items = []
|
||||||
itemsXML = self.xml.findall('{%s}item' % self.namespace)
|
itemsXML = self.xml.findall('{%s}item' % self.namespace)
|
||||||
for itemXML in itemsXML:
|
for itemXML in itemsXML:
|
||||||
item = {}
|
item = OrderedDict()
|
||||||
fieldsXML = itemXML.findall('{%s}field' % FormField.namespace)
|
fieldsXML = itemXML.findall('{%s}field' % FormField.namespace)
|
||||||
for fieldXML in fieldsXML:
|
for fieldXML in fieldsXML:
|
||||||
field = FormField(xml=fieldXML)
|
field = FormField(xml=fieldXML)
|
||||||
|
@ -168,7 +168,7 @@ class Form(ElementBase):
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def get_reported(self):
|
def get_reported(self):
|
||||||
fields = {}
|
fields = OrderedDict()
|
||||||
xml = self.xml.findall('{%s}reported/{%s}field' % (self.namespace,
|
xml = self.xml.findall('{%s}reported/{%s}field' % (self.namespace,
|
||||||
FormField.namespace))
|
FormField.namespace))
|
||||||
for field in xml:
|
for field in xml:
|
||||||
|
@ -177,7 +177,7 @@ class Form(ElementBase):
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
def get_values(self):
|
def get_values(self):
|
||||||
values = {}
|
values = OrderedDict()
|
||||||
fields = self['fields']
|
fields = self['fields']
|
||||||
for var in fields:
|
for var in fields:
|
||||||
values[var] = fields[var]['value']
|
values[var] = fields[var]['value']
|
||||||
|
|
Loading…
Reference in a new issue