Commit 21a2ae22 authored by Louis's avatar Louis
Browse files

TODOs

parent 121be484
Pipeline #7073 failed with stage
......@@ -119,7 +119,7 @@ class Renderer:
env.globals['counter'] = Counter().count
env.globals['now'] = datetime.datetime.now()
env.filters['datetime'] = operator.methodcaller('strftime', "%Y-%m-%d %H:%M:%S")
env.filters['as_id'] = as_id
env.filters['as_id'] = as_id # TODO: Remove?
env.filters['color'] = random_color
return env
......
......@@ -4,6 +4,7 @@ import jinja2
class Column:
keyword = None
title = ""
default = {}
def __init__(self, config):
......@@ -20,6 +21,10 @@ class Column:
def render(self, context, package, options):
raise NotImplementedError()
def render_error(self, column, package, message):
LOGGER.error("Package {}, column {}: {}".format(package, column, message))
return message
class Empty(Column):
keyword = "empty"
......@@ -49,7 +54,7 @@ class Link(Jinja2):
def render(self, context, package, options):
if 'href' not in options:
raise MissingArgument(self.keyword, 'href')
return self.render_error(self.keyword, package, "Missing argument 'href'.")
if 'content' not in options:
options['content'] = options['href']
super().render(context, package, options)
......@@ -2,3 +2,4 @@ from pypimonitor.column.jinja2 import Jinja2
class Readthedocs(Jinja2):
keyword = 'readthedocs'
title = 'Doc'
......@@ -15,7 +15,7 @@
<table>
<thead><tr>
{% for column in columns -%}
<td>{{ render_column(column, none) }}</td>
<td>{{ column.title }}</td>
{%- endfor %}
</tr></thead>
<tbody>
......@@ -23,7 +23,7 @@
<tr bgcolor="{{ package |color(0.1, 0.8) }}">
{% for column in columns -%}
<td>
{{ render_column(column, packages[package]) }}
{{ package|column }}
</td>
{%- endfor %}
</tr>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment