Added optional default value to _getAttr.
This commit is contained in:
parent
cbed8029ba
commit
1cedea2804
2 changed files with 5 additions and 2 deletions
|
@ -49,6 +49,9 @@ class Iq(RootStanza):
|
||||||
Stanza Interface:
|
Stanza Interface:
|
||||||
query -- The namespace of the <query> element if one exists.
|
query -- The namespace of the <query> element if one exists.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
types -- May be one of: get, set, result, or error.
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
__init__ -- Overrides StanzaBase.__init__.
|
__init__ -- Overrides StanzaBase.__init__.
|
||||||
unhandled -- Send error if there are no handlers.
|
unhandled -- Send error if there are no handlers.
|
||||||
|
|
|
@ -235,8 +235,8 @@ class ElementBase(tostring.ToString):
|
||||||
if name in self.xml.attrib:
|
if name in self.xml.attrib:
|
||||||
del self.xml.attrib[name]
|
del self.xml.attrib[name]
|
||||||
|
|
||||||
def _getAttr(self, name):
|
def _getAttr(self, name, default=''):
|
||||||
return self.xml.attrib.get(name, '')
|
return self.xml.attrib.get(name, default)
|
||||||
|
|
||||||
def _getSubText(self, name):
|
def _getSubText(self, name):
|
||||||
if '}' not in name:
|
if '}' not in name:
|
||||||
|
|
Loading…
Reference in a new issue