From ef62052984b8ff388889b87c02a659fb38435600 Mon Sep 17 00:00:00 2001 From: gauthiier Date: Thu, 26 Dec 2019 12:12:07 +0100 Subject: [PATCH] recursive tags_w_lists --- selection/sel.py | 18 ++++++-- www/templates/index.html | 51 ++--------------------- www/templates/selection_tags_w_lists.html | 7 +++- 3 files changed, 25 insertions(+), 51 deletions(-) diff --git a/selection/sel.py b/selection/sel.py index 80db892..1149f74 100644 --- a/selection/sel.py +++ b/selection/sel.py @@ -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 #
  • ' + h.subject + ' -- ' + h.author_name + ' -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): diff --git a/www/templates/index.html b/www/templates/index.html index a64b8d9..369d575 100644 --- a/www/templates/index.html +++ b/www/templates/index.html @@ -1,54 +1,11 @@ - URLCOLLECT - - -
    -

    *************************************GET::

    - - - - -

    - {% for l in lists %} - {{l}} - {% endfor %} - - -

    - - - - -

    - -
    -		{% for t in tags %}
    -		{{t}}  
    -		{% endfor %}		
    -		
    - -

    - - - -

    - --- -
    -
    
    -		---		
    -		
    -
    
    -
    -	
    -
    - - - - - +

    -INDEX-

    +

    SEARCH

    +

    TAGS

    +

    TAGS_W_LISTS

    \ No newline at end of file diff --git a/www/templates/selection_tags_w_lists.html b/www/templates/selection_tags_w_lists.html index 05bcc6d..624f578 100644 --- a/www/templates/selection_tags_w_lists.html +++ b/www/templates/selection_tags_w_lists.html @@ -22,8 +22,13 @@
      - {% for h in v.lists %} + {% for h in v.lists recursive %}
    • {{h.subject}} -- {{h.author_name}}
    • + {% if h.follow %} +
        + {{ loop(h.follow) }} +
      + {% endif %} {% endfor %}