summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-23 19:36:43 +0100
committermathieui <mathieui@mathieui.net>2015-02-24 22:46:06 +0100
commitc214e4f03775f603c05a36ad763c66be5870238d (patch)
tree2a2c870564b08fd4315dcabf01f752e24c3341f2
parent2ee05d9616d2959d19a7a87d21c58e6aae1db56e (diff)
downloadslixmpp-c214e4f03775f603c05a36ad763c66be5870238d.tar.gz
slixmpp-c214e4f03775f603c05a36ad763c66be5870238d.tar.bz2
slixmpp-c214e4f03775f603c05a36ad763c66be5870238d.tar.xz
slixmpp-c214e4f03775f603c05a36ad763c66be5870238d.zip
XEP-0084: fix setting and getting the Data value
get_value: return a bytes object set_value: accept a bytes or a str object
-rw-r--r--slixmpp/plugins/xep_0084/stanza.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/slixmpp/plugins/xep_0084/stanza.py b/slixmpp/plugins/xep_0084/stanza.py
index 174a1078..ebcd73e3 100644
--- a/slixmpp/plugins/xep_0084/stanza.py
+++ b/slixmpp/plugins/xep_0084/stanza.py
@@ -21,11 +21,11 @@ class Data(ElementBase):
def get_value(self):
if self.xml.text:
return b64decode(bytes(self.xml.text))
- return ''
+ return b''
def set_value(self, value):
if value:
- self.xml.text = b64encode(bytes(value))
+ self.xml.text = b64encode(bytes(value)).decode()
else:
self.xml.text = ''