summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--render.py4
-rw-r--r--templates/host.html4
2 files changed, 6 insertions, 2 deletions
diff --git a/render.py b/render.py
index f7e23f0..3e1d215 100644
--- a/render.py
+++ b/render.py
@@ -9,9 +9,13 @@ class Renderer:
def __init__(self, output_dir):
self.env = jinja2.Environment(
loader = jinja2.FileSystemLoader('./templates'))
+ self.env.filters['select_with_attribute'] = self.select_with_attribute
self.output_dir = output_dir
self.templates = {}
+ def select_with_attribute(self, iterable, attribute, result=True):
+ return [value for value in iterable if (attribute in value) == result]
+
def _render(self, template, filename, **kwargs):
if template not in self.templates:
self.templates[template] = self.env.get_template(template)
diff --git a/templates/host.html b/templates/host.html
index df34ab2..5f492b0 100644
--- a/templates/host.html
+++ b/templates/host.html
@@ -26,12 +26,12 @@
</div>
<div class="tab-pane row" id="interfaces">
- {% for group in addresses | groupby('interface') %}
+ {% for group in addresses | select_with_attribute('vserver', False) | groupby('interface') %}
<div class="span6">
<h3>{{ group.grouper }}</h3>
<ul>
{% for address in group.list %}
- <li>{{address['address']}} /{{address['netmask']}}</li>
+ <li>{{address['address']}}/{{address['netmask']}}</li>
{% else %}
<li>no address</li>
{% endfor %}