summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0004/stanza/field.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0004/stanza/field.py')
-rw-r--r--sleekxmpp/plugins/xep_0004/stanza/field.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sleekxmpp/plugins/xep_0004/stanza/field.py b/sleekxmpp/plugins/xep_0004/stanza/field.py
index 1e175966..51f85995 100644
--- a/sleekxmpp/plugins/xep_0004/stanza/field.py
+++ b/sleekxmpp/plugins/xep_0004/stanza/field.py
@@ -41,10 +41,11 @@ class FormField(ElementBase):
self._type = value
def add_option(self, label='', value=''):
- if self._type in self.option_types:
- opt = FieldOption(parent=self)
+ if self._type is None or self._type in self.option_types:
+ opt = FieldOption()
opt['label'] = label
opt['value'] = value
+ self.append(opt)
else:
raise ValueError("Cannot add options to " + \
"a %s field." % self['type'])