From a2b020ed3554b47c0b27982cf47431126c103ef4 Mon Sep 17 00:00:00 2001
From: Dan McGee
Date: Sun, 12 Apr 2015 09:50:13 -0500
Subject: Add true parameter to Jinja2 default filter
We need this to make it act more like the Django filter, which prints
the default value not only when the variable is undefined, but also when
it evaluates to being false (such as a None value).
Noticed by felixonmars on packages that provided other packages; None
was always showing as the comparison operator. More embarrassing is that
our file lists were always showing 'None' concatenated onto all
directory entries.
Signed-off-by: Dan McGee
---
templates/packages/details.html.jinja | 4 ++--
templates/packages/details_depend.html.jinja | 6 +++---
templates/packages/details_relatedto.html.jinja | 2 +-
templates/packages/files_list.html.jinja | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/templates/packages/details.html.jinja b/templates/packages/details.html.jinja
index 2215f8dc..9a72622d 100644
--- a/templates/packages/details.html.jinja
+++ b/templates/packages/details.html.jinja
@@ -103,7 +103,7 @@
{% endif %}
Description: |
- {{ pkg.pkgdesc|default("") }} |
+ {{ pkg.pkgdesc|default("", true) }} |
Upstream URL: |
{% if pkg.url %}
| Last Flag Request: |
From {{ flag_request.who() }} on {{ flag_request.created|date }}:
- {{ flag_request.message|linebreaksbr|default("{no message}") }} |
+ {{ flag_request.message|linebreaksbr|default("{no message}", true) }}
{% endif %}{% endwith %}{% endif %}
diff --git a/templates/packages/details_depend.html.jinja b/templates/packages/details_depend.html.jinja
index 404793b6..a2d3a010 100644
--- a/templates/packages/details_depend.html.jinja
+++ b/templates/packages/details_depend.html.jinja
@@ -1,8 +1,8 @@
{% import 'packages/details_link.html.jinja' as details %}{% if depend.pkg == None %}
-{% if depend.providers %}{{ depend.dep.name }}{{ depend.dep.comparison|default("") }}{{ depend.dep.version|default("") }} ({% for pkg in depend.providers %}{{ details.details_link(pkg) }}{% if not loop.last %}, {% endif %}{% endfor %})
-{% else %}{{ depend.dep.name }}{{ depend.dep.comparison|default("") }}{{ depend.dep.version|default("") }} (virtual)
+{% if depend.providers %}{{ depend.dep.name }}{{ depend.dep.comparison|default("", true) }}{{ depend.dep.version|default("", true) }} ({% for pkg in depend.providers %}{{ details.details_link(pkg) }}{% if not loop.last %}, {% endif %}{% endfor %})
+{% else %}{{ depend.dep.name }}{{ depend.dep.comparison|default("", true) }}{{ depend.dep.version|default("", true) }} (virtual)
{% endif %}{% else %}
-{{ details.details_link(depend.pkg) }}{{ depend.dep.comparison|default("") }}{{ depend.dep.version|default("") }}
+{{ details.details_link(depend.pkg) }}{{ depend.dep.comparison|default("", true) }}{{ depend.dep.version|default("", true) }}
{% if depend.pkg.repo.testing %} (testing)
{% endif %}{% if depend.pkg.repo.staging %} (staging)
{% endif %}{% endif %}
diff --git a/templates/packages/details_relatedto.html.jinja b/templates/packages/details_relatedto.html.jinja
index 955fdd37..818224de 100644
--- a/templates/packages/details_relatedto.html.jinja
+++ b/templates/packages/details_relatedto.html.jinja
@@ -1,3 +1,3 @@
{% import 'packages/details_link.html.jinja' as details %}{% for related in all_related %}{% with best_satisfier = related.get_best_satisfier() %}
-{% if best_satisfier == None %}{{ related.name }}{% else %}{{ details.details_link(best_satisfier) }}{% endif %}{{ related.comparison|default("") }}{{ related.version|default("") }}{% if not loop.last %}, {% endif %}
+{% if best_satisfier == None %}{{ related.name }}{% else %}{{ details.details_link(best_satisfier) }}{% endif %}{{ related.comparison|default('', true) }}{{ related.version|default('', true) }}{% if not loop.last %}, {% endif %}
{% endwith %}{% endfor %}
diff --git a/templates/packages/files_list.html.jinja b/templates/packages/files_list.html.jinja
index c8fc3b1a..ab3e1210 100644
--- a/templates/packages/files_list.html.jinja
+++ b/templates/packages/files_list.html.jinja
@@ -6,7 +6,7 @@ of the package; it may be out of date.
{% if files|length %}
{% for file in files %}
-- {{ file.directory }}{{ file.filename|default('') }}
{% endfor %}
+- {{ file.directory }}{{ file.filename|default('', true) }}
{% endfor %}
{% else %}
Package has no files.
--
cgit v1.2.3-54-g00ecf