Use a list comprehension instead of filter() to work with Python3.

This commit is contained in:
Lance Stout 2011-11-19 18:49:18 -08:00
parent f9d0b55ca3
commit 3019c82d8a

View file

@ -1205,7 +1205,7 @@ class XMLStream(object):
# to run "in stream" will be executed immediately; the rest will # to run "in stream" will be executed immediately; the rest will
# be queued. # be queued.
unhandled = True unhandled = True
matched_handlers = filter(lambda h: h.match(stanza), self.__handlers) matched_handlers = [h for h in self.__handlers if h.match(stanza)]
for handler in matched_handlers: for handler in matched_handlers:
stanza_copy = copy.copy(stanza) if len(matched_handlers) > 1 else stanza stanza_copy = copy.copy(stanza) if len(matched_handlers) > 1 else stanza
handler.prerun(stanza_copy) handler.prerun(stanza_copy)