mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-12-24 11:50:53 +00:00
* fixed bug with setting boolean values in forms
* added setValues to forms
This commit is contained in:
parent
f84f02acff
commit
8dbf53594b
1 changed files with 10 additions and 1 deletions
|
@ -104,7 +104,7 @@ class Form(FieldContainer):
|
|||
else:
|
||||
form1.field[field.var].value = field.value
|
||||
for option, label in field.options:
|
||||
if (option, label) not in form1.fields[field.var].options:
|
||||
if (option, label) not in form1.field[field.var].options:
|
||||
form1.fields[field.var].addOption(option, label)
|
||||
return form1
|
||||
|
||||
|
@ -123,6 +123,15 @@ class Form(FieldContainer):
|
|||
result[field.var] = value
|
||||
return result
|
||||
|
||||
def setValues(self, values={}):
|
||||
for field in values:
|
||||
if field in self.field:
|
||||
if isintance(values[field], list) or isinstance(values[field], tuple):
|
||||
for value in values[field]:
|
||||
self.field[field].setValue(value)
|
||||
else:
|
||||
self.field[field].setValue(values[field])
|
||||
|
||||
def fromXML(self, xml):
|
||||
self.buildForm(xml)
|
||||
|
||||
|
|
Loading…
Reference in a new issue