summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Müller <uves@spline.de>2013-08-14 11:11:43 +0200
committerroot <root@vm-staticweb.spline.inf.fu-berlin.de>2013-08-14 11:11:43 +0200
commit9159492e38a46a36a861600427f0589f2c4ec180 (patch)
tree59b135a542bcebc415dd249eb6024cc7eabe0402
parent8993442d0a9a480c57774a3496f58d66ed9e6f8a (diff)
downloadwww-9159492e38a46a36a861600427f0589f2c4ec180.tar.gz
www-9159492e38a46a36a861600427f0589f2c4ec180.tar.bz2
www-9159492e38a46a36a861600427f0589f2c4ec180.zip
render also maintainers that are not spline members
-rw-r--r--render.py4
-rw-r--r--templates/host.html6
-rw-r--r--utils.py10
3 files changed, 16 insertions, 4 deletions
diff --git a/render.py b/render.py
index 6e49a21..65181c8 100644
--- a/render.py
+++ b/render.py
@@ -4,8 +4,7 @@ import yaml
import os
import jinja2
import optparse
-from utils import filters
-from utils import tests
+from utils import filters, tests, globals
class Renderer:
def __init__(self, output_dir):
@@ -16,6 +15,7 @@ class Renderer:
loader = jinja2.FileSystemLoader(template_dir))
self.env.filters.update(filters)
self.env.tests.update(tests)
+ self.env.globals.update(globals)
self.output_dir = output_dir
self.templates = {}
diff --git a/templates/host.html b/templates/host.html
index 09c4f9d..bf30fd2 100644
--- a/templates/host.html
+++ b/templates/host.html
@@ -37,8 +37,10 @@
<dt>maintainers</dt>
<dd>
{% for maintainer in maintainers %}
- <a href="mailto:{{maintainer}}@spline.de">{{maintainer}}</a>{% if not loop.last %}, {% endif %}
- {% endfor %}
+ {% set name, mail = get_contact_info(maintainer) %}
+ <a href="mailto:{{mail}}">{{name}}</a>
+ {% if not loop.last %}, {% endif %}
+ {% endfor %}
</dd>
{% endif %}
{% if groups is defined %}
diff --git a/utils.py b/utils.py
index 1a222c8..fa76138 100644
--- a/utils.py
+++ b/utils.py
@@ -8,6 +8,12 @@ def get_os_name(name):
def select_with_attribute(iterable, attribute, result=True):
return [value for value in iterable if (attribute in value) == result]
+def get_contact_info(maintainer):
+ if type(maintainer) is dict:
+ return maintainer.popitem()
+ else:
+ return (maintainer, "%s@spline.de" % (maintainer))
+
def is_iterable(obj):
if isinstance(obj, collections.Iterable):
return True
@@ -21,3 +27,7 @@ filters = [
tests = [
('iterable', is_iterable)
]
+
+globals = [
+ ('get_contact_info', get_contact_info)
+]