in Class IRC
def _handle_event(self, connection, event):
"""[Internal]"""
h = self.handlers
for handler in h.get("all_events", []) + h.get(event.eventtype(), []):
if handler1 == "NO MORE":
return
by doing the get for "all_events" first the priority is being ignored. example: the all_events handlers will always be called before the _pingponger even though the pingponger priority is -42...
simple fix is to reverse the order and assume that the all_events will always be lower priority than any single command
or
proper fix is to resort before iterating.
This patch should fix the issue:
diff --git a/irclib.py b/irclib.py
index 5f7141c..bed4c1e 100644
--- a/irclib.py
+++ b/irclib.py
@@ -321,7 +321,9 @@ class IRC:
def _handle_event(self, connection, event):
"""[Internal]"""
h = self.handlers
- for handler in h.get("all_events", []) + h.get(event.eventtype(), []):
+ th = h.get("all_events", []) + h.get(event.eventtype(),[])
+ th.sort()
+ for handler in th: #h.get("all_events", []) + h.get(event.eventtype(), []):
if handler1 == "NO MORE":
return
Of course, I can't add any file and all the spaces were removed ...
Well, the idea is to create and sort the list before the 'for' statement.
Fixed in https://bitbucket.org/xrogaan/python-irclib/changeset/9710d61d58ac