mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] List hooks with the same name but another priority in hook_list
This commit is contained in:
parent
908ad8929a
commit
ba02319915
1 changed files with 13 additions and 2 deletions
15
hook.py
15
hook.py
|
@ -111,8 +111,19 @@ def hook_list(action, list_by='name', show_info=False):
|
||||||
elif list_by == 'name' or list_by == 'folder':
|
elif list_by == 'name' or list_by == 'folder':
|
||||||
if show_info:
|
if show_info:
|
||||||
def _append_hook(d, priority, name, path):
|
def _append_hook(d, priority, name, path):
|
||||||
# Use the name as key and hook info as value
|
# Use the name as key and a list of hooks info - the
|
||||||
d[name] = { 'priority': priority, 'path': path }
|
# executed ones with this name - as value
|
||||||
|
l = d.get(name, list())
|
||||||
|
for h in l:
|
||||||
|
# Only one priority for the hook is accepted
|
||||||
|
if h['priority'] == priority:
|
||||||
|
# Custom hooks overwrite system ones and they
|
||||||
|
# are appended at the end - so overwite it
|
||||||
|
if h['path'] != path:
|
||||||
|
h['path'] = path
|
||||||
|
return
|
||||||
|
l.append({ 'priority': priority, 'path': path })
|
||||||
|
d[name] = l
|
||||||
else:
|
else:
|
||||||
if list_by == 'name':
|
if list_by == 'name':
|
||||||
result = set()
|
result = set()
|
||||||
|
|
Loading…
Add table
Reference in a new issue