Skip to content

Commit

Permalink
Hide GPG column if no GPG signatures in release (#2656)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Nov 15, 2024
1 parent 452480d commit bc51c60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions downloads/templatetags/download_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ def strip_minor_version(version):
return '.'.join(version.split('.')[:2])


@register.filter
def has_gpg(files: list) -> bool:
return any(f.gpg_signature_file for f in files)


@register.filter
def has_sigstore_materials(files):
return any(
Expand Down
5 changes: 5 additions & 0 deletions templates/downloads/release_detail.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "base.html" %}
{% load boxes %}
{% load sitetree %}
{% load has_gpg from download_tags %}
{% load has_sigstore_materials from download_tags %}
{% load has_sbom from download_tags %}
{% load sort_windows from download_tags %}
Expand Down Expand Up @@ -51,7 +52,9 @@ <h1 class="page-title">Files</h1>
<th>Description</th>
<th>MD5 Sum</th>
<th>File Size</th>
{% if release_files|has_gpg %}
<th>GPG</th>
{% endif %}
{% if release_files|has_sigstore_materials %}
<th colspan="2"><a href="https://www.python.org/download/sigstore/">Sigstore</a></th>
{% endif %}
Expand All @@ -68,7 +71,9 @@ <h1 class="page-title">Files</h1>
<td>{{ f.description }}</td>
<td>{{ f.md5_sum }}</td>
<td>{{ f.filesize|filesizeformat }}</td>
{% if release_files|has_gpg %}
<td>{% if f.gpg_signature_file %}<a href="{{ f.gpg_signature_file }}">SIG</a>{% endif %}</td>
{% endif %}
{% if release_files|has_sigstore_materials %}
{% if f.sigstore_bundle_file %}
<td colspan="2">{% if f.sigstore_bundle_file %}<a href="{{ f.sigstore_bundle_file}}">.sigstore</a>{% endif %}</td>
Expand Down

0 comments on commit bc51c60

Please sign in to comment.