Skip to content

Hide GPG column if no GPG signatures in release #2656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading