added stanza.get(key, defaultvalue)

This commit is contained in:
Nathan Fritz 2010-01-09 13:17:08 -08:00
parent 2193d5c962
commit d14045f5a6

View file

@ -71,6 +71,12 @@ class ElementBase(object):
self.xml.remove(aff.xml) self.xml.remove(aff.xml)
return aff return aff
def get(self, key, defaultvalue=None):
value = self[key]
if value is None or value == '':
return defaultvalue
return value
def keys(self): def keys(self):
out = [] out = []
out += [x for x in self.interfaces] out += [x for x in self.interfaces]