diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-17 21:22:03 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-17 21:22:03 -0700 |
commit | 62230fc970f86b11bc74ee448e30cbe93f477e72 (patch) | |
tree | 069e7997db632ed08934ab9b2cdf41be7fbde3b4 /sleekxmpp/plugins/xep_0004/stanza/field.py | |
parent | 961668d420d2241541f4facc64265932c66ad81c (diff) | |
download | slixmpp-62230fc970f86b11bc74ee448e30cbe93f477e72.tar.gz slixmpp-62230fc970f86b11bc74ee448e30cbe93f477e72.tar.bz2 slixmpp-62230fc970f86b11bc74ee448e30cbe93f477e72.tar.xz slixmpp-62230fc970f86b11bc74ee448e30cbe93f477e72.zip |
Return '' instead of None from form fields with no values.
Diffstat (limited to 'sleekxmpp/plugins/xep_0004/stanza/field.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0004/stanza/field.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0004/stanza/field.py b/sleekxmpp/plugins/xep_0004/stanza/field.py index 43293bfd..8131233c 100644 --- a/sleekxmpp/plugins/xep_0004/stanza/field.py +++ b/sleekxmpp/plugins/xep_0004/stanza/field.py @@ -85,7 +85,7 @@ class FormField(ElementBase): return None elif self._type == 'boolean': return valsXML[0].text in self.true_values - elif self._type in self.multi_value_types: + elif self._type in self.multi_value_types or len(valsXML) > 1: values = [] for valXML in valsXML: if valXML.text is None: @@ -95,6 +95,8 @@ class FormField(ElementBase): values = "\n".join(values) return values else: + if valsXML[0].text is None: + return '' return valsXML[0].text def set_answer(self, answer): |