From 1cedea280499c0b7f7debb6c95442038d8f2d89c Mon Sep 17 00:00:00 2001
From: Lance Stout <lancestout@gmail.com>
Date: Fri, 30 Jul 2010 14:11:24 -0400
Subject: Added optional default value to _getAttr.

---
 sleekxmpp/stanza/iq.py            | 3 +++
 sleekxmpp/xmlstream/stanzabase.py | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

(limited to 'sleekxmpp')

diff --git a/sleekxmpp/stanza/iq.py b/sleekxmpp/stanza/iq.py
index c735ae64..c5ef8bb4 100644
--- a/sleekxmpp/stanza/iq.py
+++ b/sleekxmpp/stanza/iq.py
@@ -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.
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 5b41a406..94ff958c 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -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:
-- 
cgit v1.2.3