summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream
diff options
context:
space:
mode:
authorfritzy <fritzy@ip-10-251-242-239.ec2.internal>2010-08-21 22:48:43 +0000
committerfritzy <fritzy@ip-10-251-242-239.ec2.internal>2010-08-21 22:48:43 +0000
commit345656926ea5ee8e8cc359b97fd1d0cbc4b1fab4 (patch)
treeca0c851734641f6c4a0169528eee19bd706191be /sleekxmpp/xmlstream
parentc05ddcb7f5eaa5bbf7efb4e765d04b62212a3394 (diff)
downloadslixmpp-345656926ea5ee8e8cc359b97fd1d0cbc4b1fab4.tar.gz
slixmpp-345656926ea5ee8e8cc359b97fd1d0cbc4b1fab4.tar.bz2
slixmpp-345656926ea5ee8e8cc359b97fd1d0cbc4b1fab4.tar.xz
slixmpp-345656926ea5ee8e8cc359b97fd1d0cbc4b1fab4.zip
added form compatibility with old api, stanzas now bool() to True on 2.x, jid attributes will return '' if not set
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r--sleekxmpp/xmlstream/jid.py10
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py5
2 files changed, 9 insertions, 6 deletions
diff --git a/sleekxmpp/xmlstream/jid.py b/sleekxmpp/xmlstream/jid.py
index 292abd92..3e997113 100644
--- a/sleekxmpp/xmlstream/jid.py
+++ b/sleekxmpp/xmlstream/jid.py
@@ -59,24 +59,24 @@ class JID(object):
if name == 'resource':
if self._resource is None:
self._resource = self._jid.split('/', 1)[-1]
- return self._resource
+ return self._resource or ""
elif name == 'user':
if self._user is None:
if '@' in self._jid:
self._user = self._jid.split('@', 1)[0]
else:
self._user = self._user
- return self._user
+ return self._user or ""
elif name in ('server', 'domain'):
if self._domain is None:
self._domain = self._jid.split('@', 1)[-1].split('/', 1)[0]
- return self._domain
+ return self._domain or ""
elif name == 'full':
- return self._jid
+ return self._jid or ""
elif name == 'bare':
if self._bare is None:
self._bare = self._jid.split('/', 1)[0]
- return self._bare
+ return self._bare or ""
def __setattr__(self, name, value):
"""
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 3223901a..7458f3c7 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -362,7 +362,10 @@ class ElementBase(object):
self.idx = 0
return self
- def __bool__(self):
+ def __bool__(self): #python 3.x
+ return True
+
+ def __nonzero__(self): #python 2.x
return True
def __next__(self):