Mercurial > farol > farol
comparison farol/templates/producttree/view_product.j2 @ 137:5a44d377aad5
Simplify code, don't use the map filter (Jinja>=2.7)
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 27 Oct 2014 11:20:06 +0100 |
parents | 1feed9a3156e |
children |
comparison
equal
deleted
inserted
replaced
136:64a6e69d54fc | 137:5a44d377aad5 |
---|---|
74 {% endcall %} | 74 {% endcall %} |
75 | 75 |
76 {% call panel(heading="Vulnerabilities", title="3", collapsible=False) %} | 76 {% call panel(heading="Vulnerabilities", title="3", collapsible=False) %} |
77 <p>The following Vulneralibities are mentionning this product:</p> | 77 <p>The following Vulneralibities are mentionning this product:</p> |
78 <ul> | 78 <ul> |
79 {% for vulnerability in cvrf._vulnerabilities if ( | 79 {% for vulnerability in cvrf._vulnerabilities %} |
80 vulnerability.isMentioningProdId(product._productid) or | 80 {%- set elements = vulnerability.mentionsProdId(product._productid) | list %} |
81 vulnerability.isMentioningGroupId(groups | map(attribute="_groupid") | list)) %} | 81 {%- for group in groups %} |
82 <li> | 82 {{- elements.extend(vulnerability.mentionsGroupId(group._groupid) | list) or '' }} |
83 <a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a> | 83 {%- endfor %} |
84 {%- set elements = vulnerability.mentionsProdId(product._productid) | list %} | 84 {% if elements %} |
85 {%- for group in groups %} | 85 <li> |
86 {{- elements.extend(vulnerability.mentionsGroupId(group._groupid) | list) or '' }} | 86 <a href="{{ url_for('vulnerability.view', ordinal=vulnerability._ordinal) }}">{{ vulnerability.getTitle() }}</a> |
87 {%- endfor %} | 87 {%- set comma = joiner(', ') %} |
88 {%- set comma = joiner(', ') %} | 88 ({% for grouper, list in elements | groupby('NAME') %}{{ comma() -}} |
89 ({% for grouper, list in elements | groupby('NAME') %}{{ comma() -}} | 89 {{ grouper }}{% if list | length > 1 %} (x{{ list | length }}){% endif %} |
90 {{ grouper }}{% if list | length > 1 %} (x{{ list | length }}){% endif %} | 90 {%- endfor %}) |
91 {%- endfor %}) | 91 </li> |
92 </li> | 92 {% endif %} |
93 {% else %} | |
94 <li><em>None</em></li> | |
95 {% endfor %} | 93 {% endfor %} |
96 </ul> | 94 </ul> |
97 {% endcall %} | 95 {% endcall %} |
98 <div class="pull-right"> | 96 <div class="pull-right"> |
99 {% if cvrf.isProductOrphan(product._productid) %} | 97 {% if cvrf.isProductOrphan(product._productid) %} |