summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/stanzabase.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@key.local>2010-01-09 13:17:08 -0800
committerNathan Fritz <fritzy@key.local>2010-01-09 13:17:08 -0800
commitd14045f5a6eec370f0374b1e7dab6eb58bc70d48 (patch)
tree8fb41f18beccfdfc2e3b43c10754c5a829c37794 /sleekxmpp/xmlstream/stanzabase.py
parent2193d5c962d3a05fa81ca7285ef1463d2d471ba5 (diff)
downloadslixmpp-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.py6
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]