recursive tags_w_lists

This commit is contained in:
gauthiier
2019-12-26 12:12:07 +01:00
parent bd87247240
commit ef62052984
3 changed files with 25 additions and 51 deletions
+15 -3
View File
@@ -131,7 +131,7 @@ def tags_w_lists():
t = {'tag': k, 'desc': v['desc']}
l = []
for m in v['lists']:
l += recursive_info(m)
l += recursive_info(m, keep_hierachy=True)
t['lists'] = l
tags.append(t)
return tags
@@ -189,11 +189,23 @@ def recursive_urls(msg):
return r
# <li><a href="' + h.url+ '" target="_blank">' + h.subject + '</a> -- <i>' + h.author_name + '</i>
def recursive_info(msg):
def recursive_info(msg, keep_hierachy=False):
r = [{'url': msg['url'], 'subject': msg['subject'], 'author_name': msg['author_name']}]
if keep_hierachy:
rr = []
if 'follow-up' in list(msg.keys()):
for m in msg['follow-up']:
r += recursive_info(m)
if keep_hierachy:
rr += recursive_info(m)
else:
r += recursive_info(m)
if keep_hierachy:
r[0]['follow'] = rr #note: change of field name
return r
def commit_selection(li, url, tag):