diff options
author | Nathan Fritz <fritzy@key.local> | 2010-01-09 13:17:08 -0800 |
---|---|---|
committer | Nathan Fritz <fritzy@key.local> | 2010-01-09 13:17:08 -0800 |
commit | d14045f5a6eec370f0374b1e7dab6eb58bc70d48 (patch) | |
tree | 8fb41f18beccfdfc2e3b43c10754c5a829c37794 /sleekxmpp/xmlstream/stanzabase.py | |
parent | 2193d5c962d3a05fa81ca7285ef1463d2d471ba5 (diff) | |
download | slixmpp-d14045f5a6eec370f0374b1e7dab6eb58bc70d48.tar.gz slixmpp-d14045f5a6eec370f0374b1e7dab6eb58bc70d48.tar.bz2 slixmpp-d14045f5a6eec370f0374b1e7dab6eb58bc70d48.tar.xz slixmpp-d14045f5a6eec370f0374b1e7dab6eb58bc70d48.zip |
added stanza.get(key, defaultvalue)
Diffstat (limited to 'sleekxmpp/xmlstream/stanzabase.py')
-rw-r--r-- | sleekxmpp/xmlstream/stanzabase.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py index d4c1118f..8bdcb0b0 100644 --- a/sleekxmpp/xmlstream/stanzabase.py +++ b/sleekxmpp/xmlstream/stanzabase.py @@ -71,6 +71,12 @@ class ElementBase(object): self.xml.remove(aff.xml) return aff + def get(self, key, defaultvalue=None): + value = self[key] + if value is None or value == '': + return defaultvalue + return value + def keys(self): out = [] out += [x for x in self.interfaces] |