diff options
Diffstat (limited to 'sleekxmpp/xmlstream')
-rw-r--r-- | sleekxmpp/xmlstream/jid.py | 10 | ||||
-rw-r--r-- | sleekxmpp/xmlstream/stanzabase.py | 5 |
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): |