summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0009/binding.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0009/binding.py')
-rw-r--r--sleekxmpp/plugins/xep_0009/binding.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0009/binding.py b/sleekxmpp/plugins/xep_0009/binding.py
index b4395707..a55993ad 100644
--- a/sleekxmpp/plugins/xep_0009/binding.py
+++ b/sleekxmpp/plugins/xep_0009/binding.py
@@ -6,10 +6,14 @@
See the file LICENSE for copying permission.
"""
-from xml.etree import cElementTree as ET
+from sleekxmpp.xmlstream import ET
import base64
import logging
import time
+import sys
+
+if sys.version_info > (3, 0):
+ unicode = str
log = logging.getLogger(__name__)
@@ -54,7 +58,7 @@ def _py2xml(*args):
boolean = ET.Element("{%s}boolean" % _namespace)
boolean.text = str(int(x))
val.append(boolean)
- elif type(x) is str:
+ elif type(x) in (str, unicode):
string = ET.Element("{%s}string" % _namespace)
string.text = x
val.append(string)
@@ -152,7 +156,7 @@ class rpctime(object):
def __init__(self,data=None):
#assume string data is in iso format YYYYMMDDTHH:MM:SS
- if type(data) is str:
+ if type(data) in (str, unicode):
self.timestamp = time.strptime(data,"%Y%m%dT%H:%M:%S")
elif type(data) is time.struct_time:
self.timestamp = data