summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-05-20 16:48:13 -0400
committerLance Stout <lancestout@gmail.com>2011-05-20 16:48:13 -0400
commit6b274a2543744f9b94823f5bd2a6c23ec8cc3f75 (patch)
tree6272aac508277e9ce0f14c8c15912719d616a575 /sleekxmpp/xmlstream
parent6a07e7cbe3e995f44ca3ba75a0ff83616269cf5a (diff)
downloadslixmpp-6b274a2543744f9b94823f5bd2a6c23ec8cc3f75.tar.gz
slixmpp-6b274a2543744f9b94823f5bd2a6c23ec8cc3f75.tar.bz2
slixmpp-6b274a2543744f9b94823f5bd2a6c23ec8cc3f75.tar.xz
slixmpp-6b274a2543744f9b94823f5bd2a6c23ec8cc3f75.zip
Fix double roster entry issue with Unicode.
JIDs with Unicode values were being encoded by the JID class instead of leaving them as just Unicode strings. It may still be a good idea to use from __future__ import unicode_literals pretty much everywhere though. Fixes issue #88.
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/jid.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/jid.py b/sleekxmpp/xmlstream/jid.py
index 5019a25e..36b33056 100644
--- a/sleekxmpp/xmlstream/jid.py
+++ b/sleekxmpp/xmlstream/jid.py
@@ -6,6 +6,8 @@
See the file LICENSE for copying permission.
"""
+from __future__ import unicode_literals
+
class JID(object):
"""
@@ -42,7 +44,9 @@ class JID(object):
Arguments:
jid - The new JID value.
"""
- self._full = self._jid = str(jid)
+ if isinstance(jid, JID):
+ jid = jid.full
+ self._full = self._jid = jid
self._domain = None
self._resource = None
self._user = None
@@ -123,10 +127,11 @@ class JID(object):
return self.full
def __repr__(self):
- return str(self)
+ return self.full
def __eq__(self, other):
"""
Two JIDs are considered equal if they have the same full JID value.
"""
- return str(other) == str(self)
+ other = JID(other)
+ return self.full == other.full