Do not copy the stanza before calling each handler
This commit is contained in:
parent
565da65ccd
commit
1207c81ab5
1 changed files with 3 additions and 7 deletions
|
@ -901,15 +901,11 @@ class XMLStream(object):
|
||||||
handled = False
|
handled = False
|
||||||
matched_handlers = [h for h in self.__handlers if h.match(stanza)]
|
matched_handlers = [h for h in self.__handlers if h.match(stanza)]
|
||||||
for handler in matched_handlers:
|
for handler in matched_handlers:
|
||||||
if len(matched_handlers) > 1:
|
handler.prerun(stanza)
|
||||||
stanza_copy = copy.copy(stanza)
|
|
||||||
else:
|
|
||||||
stanza_copy = stanza
|
|
||||||
handler.prerun(stanza_copy)
|
|
||||||
try:
|
try:
|
||||||
handler.run(stanza_copy)
|
handler.run(stanza)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
stanza_copy.exception(e)
|
stanza.exception(e)
|
||||||
if handler.check_delete():
|
if handler.check_delete():
|
||||||
self.__handlers.remove(handler)
|
self.__handlers.remove(handler)
|
||||||
handled = True
|
handled = True
|
||||||
|
|
Loading…
Reference in a new issue