summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/stanzabase.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-08-13 10:12:51 -0400
committerLance Stout <lancestout@gmail.com>2010-08-13 10:12:51 -0400
commitb0fb205c165311b3b66d36b87a2632dcd70d018a (patch)
tree6f79bdfe5de1183f11a05614a135525ecd0d104f /sleekxmpp/xmlstream/stanzabase.py
parent4b52007e8c39566bb2083a2e4041de4b294c4948 (diff)
downloadslixmpp-b0fb205c165311b3b66d36b87a2632dcd70d018a.tar.gz
slixmpp-b0fb205c165311b3b66d36b87a2632dcd70d018a.tar.bz2
slixmpp-b0fb205c165311b3b66d36b87a2632dcd70d018a.tar.xz
slixmpp-b0fb205c165311b3b66d36b87a2632dcd70d018a.zip
Updated registerStanzaPlugin and the XML test type.
Diffstat (limited to 'sleekxmpp/xmlstream/stanzabase.py')
-rw-r--r--sleekxmpp/xmlstream/stanzabase.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/sleekxmpp/xmlstream/stanzabase.py b/sleekxmpp/xmlstream/stanzabase.py
index 687fc4f7..feadbd47 100644
--- a/sleekxmpp/xmlstream/stanzabase.py
+++ b/sleekxmpp/xmlstream/stanzabase.py
@@ -15,16 +15,22 @@ from xml.etree import cElementTree as ET
from sleekxmpp.xmlstream import JID
from sleekxmpp.xmlstream.tostring import tostring
-xmltester = type(ET.Element('xml'))
+
+# Used to check if an argument is an XML object.
+XML_TYPE = type(ET.Element('xml'))
def registerStanzaPlugin(stanza, plugin):
- """
- Associate a stanza object as a plugin for another stanza.
- """
- tag = "{%s}%s" % (plugin.namespace, plugin.name)
- stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin
- stanza.plugin_tag_map[tag] = plugin
+ """
+ Associate a stanza object as a plugin for another stanza.
+
+ Arguments:
+ stanza -- The class of the parent stanza.
+ plugin -- The class of the plugin stanza.
+ """
+ tag = "{%s}%s" % (plugin.namespace, plugin.name)
+ stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin
+ stanza.plugin_tag_map[tag] = plugin
class ElementBase(object):
@@ -84,7 +90,7 @@ class ElementBase(object):
def append(self, item):
if not isinstance(item, ElementBase):
- if type(item) == xmltester:
+ if type(item) == XML_TYPE:
return self.appendxml(item)
else:
raise TypeError