summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2009-10-27 01:05:30 +0000
committerNathan Fritz <fritzy@netflint.net>2009-10-27 01:05:30 +0000
commit8dbf53594bc9ea0aec1ecd81092d806d001a7b6c (patch)
tree720de2aa01fad3acf61872970462756511d4b84b /sleekxmpp
parentf84f02acff4dcb4796026638e017c926772a24f2 (diff)
downloadslixmpp-8dbf53594bc9ea0aec1ecd81092d806d001a7b6c.tar.gz
slixmpp-8dbf53594bc9ea0aec1ecd81092d806d001a7b6c.tar.bz2
slixmpp-8dbf53594bc9ea0aec1ecd81092d806d001a7b6c.tar.xz
slixmpp-8dbf53594bc9ea0aec1ecd81092d806d001a7b6c.zip
* fixed bug with setting boolean values in forms
* added setValues to forms
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/plugins/xep_0004.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0004.py b/sleekxmpp/plugins/xep_0004.py
index 62587db6..faee631c 100644
--- a/sleekxmpp/plugins/xep_0004.py
+++ b/sleekxmpp/plugins/xep_0004.py
@@ -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)