summaryrefslogtreecommitdiff
path: root/sleekxmpp
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-12-30 21:43:39 -0500
committerLance Stout <lancestout@gmail.com>2011-12-30 21:43:39 -0500
commit6722b0224ae7673e3754552bdcbad714dc00b529 (patch)
tree080fdfd5f69058b5c55c2b88b5a83d28c12746ed /sleekxmpp
parent8eb225bdecd33e85b5b0e6c447f0ae4eee47201f (diff)
downloadslixmpp-6722b0224ae7673e3754552bdcbad714dc00b529.tar.gz
slixmpp-6722b0224ae7673e3754552bdcbad714dc00b529.tar.bz2
slixmpp-6722b0224ae7673e3754552bdcbad714dc00b529.tar.xz
slixmpp-6722b0224ae7673e3754552bdcbad714dc00b529.zip
Add option to disable condensing and converting form values.
XEP-0115 needs to use the raw XML character data.
Diffstat (limited to 'sleekxmpp')
-rw-r--r--sleekxmpp/plugins/xep_0004/stanza/field.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0004/stanza/field.py b/sleekxmpp/plugins/xep_0004/stanza/field.py
index 8131233c..6814e157 100644
--- a/sleekxmpp/plugins/xep_0004/stanza/field.py
+++ b/sleekxmpp/plugins/xep_0004/stanza/field.py
@@ -79,19 +79,21 @@ class FormField(ElementBase):
reqXML = self.xml.find('{%s}required' % self.namespace)
return reqXML is not None
- def get_value(self):
+ def get_value(self, convert=True):
valsXML = self.xml.findall('{%s}value' % self.namespace)
if len(valsXML) == 0:
return None
elif self._type == 'boolean':
- return valsXML[0].text in self.true_values
+ if convert:
+ return valsXML[0].text in self.true_values
+ return valsXML[0].text
elif self._type in self.multi_value_types or len(valsXML) > 1:
values = []
for valXML in valsXML:
if valXML.text is None:
valXML.text = ''
values.append(valXML.text)
- if self._type == 'text-multi':
+ if self._type == 'text-multi' and condense:
values = "\n".join(values)
return values
else: