XEP-0084: fix setting and getting the Data value
get_value: return a bytes object set_value: accept a bytes or a str object
This commit is contained in:
parent
2ee05d9616
commit
c214e4f037
1 changed files with 2 additions and 2 deletions
|
@ -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 = ''
|
||||
|
||||
|
|
Loading…
Reference in a new issue