diff options
author | Mike Taylor <bear42@gmail.com> | 2015-04-11 18:12:40 -0400 |
---|---|---|
committer | Mike Taylor <bear42@gmail.com> | 2015-04-11 18:12:40 -0400 |
commit | 48857b0030fd53d19ebc07a50a7ec6cecdc8f558 (patch) | |
tree | 6f458d49a8cd1d9c214b90b24b2e178789b89b62 /sleekxmpp | |
parent | 1fe7f5f4e6317c6287f380f56f3ce1ad2faa0638 (diff) | |
parent | 81b7b2c1908e0f6a5435ce67745b5f4dafb59816 (diff) | |
download | slixmpp-48857b0030fd53d19ebc07a50a7ec6cecdc8f558.tar.gz slixmpp-48857b0030fd53d19ebc07a50a7ec6cecdc8f558.tar.bz2 slixmpp-48857b0030fd53d19ebc07a50a7ec6cecdc8f558.tar.xz slixmpp-48857b0030fd53d19ebc07a50a7ec6cecdc8f558.zip |
Merge pull request #354 from erigones/develop
Fixed bug #353 Python3 XEP-0084 error
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/plugins/xep_0084/stanza.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0084/stanza.py b/sleekxmpp/plugins/xep_0084/stanza.py index 22f11b72..fd21e6f1 100644 --- a/sleekxmpp/plugins/xep_0084/stanza.py +++ b/sleekxmpp/plugins/xep_0084/stanza.py @@ -8,7 +8,7 @@ from base64 import b64encode, b64decode -from sleekxmpp.util import bytes +from sleekxmpp.util import bytes as sbytes from sleekxmpp.xmlstream import ET, ElementBase, register_stanza_plugin @@ -20,12 +20,15 @@ class Data(ElementBase): def get_value(self): if self.xml.text: - return b64decode(bytes(self.xml.text)) + return b64decode(sbytes(self.xml.text)) return '' def set_value(self, value): if value: - self.xml.text = b64encode(bytes(value)) + self.xml.text = b64encode(sbytes(value)) + # Python3 base64 encoded is bytes and needs to be decoded to string + if isinstance(self.xml.text, bytes): + self.xml.text = self.xml.text.decode() else: self.xml.text = '' |