From c22079e243b60a08c97fbb7c229dea4f5669c4ea Mon Sep 17 00:00:00 2001 From: Baptiste BEAUPLAT Date: Mon, 26 Nov 2018 22:04:29 +0100 Subject: [PATCH] Use escape filter as default for Plugins mako templates (Closes #31) --- debexpo/model/package_info.py | 3 +++ debexpo/templates/plugins/lintian/html.mako | 4 ++-- debexpo/templates/plugins/lintian/text.mako | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/debexpo/model/package_info.py b/debexpo/model/package_info.py index e9b2c838..a8f8cdce 100644 --- a/debexpo/model/package_info.py +++ b/debexpo/model/package_info.py @@ -94,6 +94,9 @@ class PackageInfo(OrmObject): directories = PLUGINS_TEMPLATE_DIRS, input_encoding='utf-8', output_encoding='utf-8', + default_filters=['escape'], + imports=['from webhelpers.html import escape', + 'from debexpo.lib.filters import semitrusted'] ) for basefile in try_files: diff --git a/debexpo/templates/plugins/lintian/html.mako b/debexpo/templates/plugins/lintian/html.mako index 23a6e109..57ec9acf 100644 --- a/debexpo/templates/plugins/lintian/html.mako +++ b/debexpo/templates/plugins/lintian/html.mako @@ -33,11 +33,11 @@ ${package} % for severity in sorted(o.rich_data[package], key = severity_key): % for tag in sorted(o.rich_data[package][severity]):
  • -${decode_severity(severity)} ${tag_to_a(tag)} +${decode_severity(severity)|n} ${tag_to_a(tag)|n} % if any(o.rich_data[package][severity][tag]): % endif diff --git a/debexpo/templates/plugins/lintian/text.mako b/debexpo/templates/plugins/lintian/text.mako index 6745705e..0f6c2b8b 100644 --- a/debexpo/templates/plugins/lintian/text.mako +++ b/debexpo/templates/plugins/lintian/text.mako @@ -4,7 +4,7 @@ % for tag in sorted(o.rich_data[package][severity]): % if any(o.rich_data[package][severity][tag]): % for data in o.rich_data[package][severity][tag]: -${severity}: ${package}: ${tag} ${" ".join(data) | h} +${severity}: ${package}: ${tag} ${" ".join(data)} % endfor % endif % endfor -- GitLab