Added optional default value to _getAttr.

This commit is contained in:
Lance Stout 2010-07-30 14:11:24 -04:00
parent cbed8029ba
commit 1cedea2804
2 changed files with 5 additions and 2 deletions

View file

@ -49,6 +49,9 @@ class Iq(RootStanza):
Stanza Interface:
query -- The namespace of the <query> element if one exists.
Attributes:
types -- May be one of: get, set, result, or error.
Methods:
__init__ -- Overrides StanzaBase.__init__.
unhandled -- Send error if there are no handlers.

View file

@ -235,8 +235,8 @@ class ElementBase(tostring.ToString):
if name in self.xml.attrib:
del self.xml.attrib[name]
def _getAttr(self, name):
return self.xml.attrib.get(name, '')
def _getAttr(self, name, default=''):
return self.xml.attrib.get(name, default)
def _getSubText(self, name):
if '}' not in name: