A few cleanups to make things simpler.

This commit is contained in:
Lance Stout 2010-09-01 14:20:34 -04:00
parent 3749c1b88c
commit aebd115ba2
2 changed files with 4 additions and 7 deletions

View file

@ -41,7 +41,7 @@ class Waiter(BaseHandler):
matcher -- A matcher object to detect the desired stanza. matcher -- A matcher object to detect the desired stanza.
stream -- Optional XMLStream instance to monitor. stream -- Optional XMLStream instance to monitor.
""" """
BaseHandler.__init__(self, name, matcher) BaseHandler.__init__(self, name, matcher, stream=stream)
self._payload = queue.Queue() self._payload = queue.Queue()
def prerun(self, payload): def prerun(self, payload):

View file

@ -594,8 +594,8 @@ class ElementBase(object):
tag = components[0] tag = components[0]
attributes = components[1:] attributes = components[1:]
if tag not in (self.name, "{%s}%s" % (self.namespace, self.name), if tag not in (self.name, "{%s}%s" % (self.namespace, self.name)) and \
self.plugins, self.plugin_attrib): tag not in self.plugins and tag not in self.plugin_attrib:
# The requested tag is not in this stanza, so no match. # The requested tag is not in this stanza, so no match.
return False return False
@ -786,14 +786,11 @@ class ElementBase(object):
# that do not have namespaces. # that do not have namespaces.
namespace = ns_block.split('}')[0] namespace = ns_block.split('}')[0]
elements = ns_block.split('}')[1].split('/') elements = ns_block.split('}')[1].split('/')
elif propagate_ns: else:
# Apply the stanza's namespace to the following # Apply the stanza's namespace to the following
# elements since no namespace was provided. # elements since no namespace was provided.
namespace = self.namespace namespace = self.namespace
elements = ns_block.split('/') elements = ns_block.split('/')
else:
# We don't want to propagate namespaces.
elements = ns_block.split('/')
for element in elements: for element in elements:
if element: if element: