aboutsummaryrefslogtreecommitdiff
path: root/src/EventManager.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-07-30 15:23:13 +0100
committerGravatar jesopo2019-07-30 15:23:13 +0100
commit27a6078f209a8bfe0ebc2e040c22c2b08231a8bb (patch)
treecc2b4da9c6c8082745e5f7ce09756396f0a40689 /src/EventManager.py
parentRevert "we should be checking if the new hook has a higher priority" (diff)
signature
Revert "hook priority position should default to 0, not end"
This reverts commit ff0cc59507249da262535895129d9ec3258b56a5.
Diffstat (limited to 'src/EventManager.py')
-rw-r--r--src/EventManager.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/EventManager.py b/src/EventManager.py
index b09847c4..5a19f35e 100644
--- a/src/EventManager.py
+++ b/src/EventManager.py
@@ -148,13 +148,14 @@ class EventRoot(object):
self._hooks[path_str] = []
hook_array = self._hooks[path_str]
- hook_position = 0
+ hooked = False
for i, other_hook in enumerate(hook_array):
if other_hook.priority > new_hook.priority:
- hook_position = i
+ hooked = True
+ hook_array.insert(i, new_hook)
break
-
- hook_array.insert(hook_position, new_hook)
+ if not hooked:
+ hook_array.append(new_hook)
return new_hook
def _call(self, path: typing.List[str], kwargs: dict, safe: bool,