Skip to content

Commit 1933ef5

Browse files
authored
Only show MD5 or SHA-256 columns if there's data to show (#2867)
1 parent 848bab1 commit 1933ef5

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

downloads/templatetags/download_tags.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ def has_sbom(files):
8080
return any(f.sbom_spdx2_file for f in files)
8181

8282

83+
@register.filter
84+
def has_md5(files):
85+
return any(f.md5_sum for f in files)
86+
87+
88+
@register.filter
89+
def has_sha256(files):
90+
return any(f.sha256_sum for f in files)
91+
92+
8393
@register.filter
8494
def sort_windows(files):
8595
if not files:

templates/downloads/release_detail.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{% load has_gpg from download_tags %}
55
{% load has_sigstore_materials from download_tags %}
66
{% load has_sbom from download_tags %}
7+
{% load has_md5 from download_tags %}
8+
{% load has_sha256 from download_tags %}
79
{% load sort_windows from download_tags %}
810
{% load get_eol_info from download_tags %}
911

@@ -85,11 +87,9 @@ <h3>{{ f.os.name }}</h3>
8587
<thead>
8688
<tr>
8789
<th>Version</th>
88-
<th>Operating System</th>
90+
<th>Operating system</th>
8991
<th>Description</th>
90-
<th>MD5 Checksum</th>
91-
<th>SHA256 Checksum</th>
92-
<th>File Size</th>
92+
<th>File size</th>
9393
{% if release_files|has_sigstore_materials %}
9494
<th colspan="2"><a href="https://www.python.org/download/sigstore/">Sigstore</a></th>
9595
{% endif %}
@@ -99,6 +99,11 @@ <h3>{{ f.os.name }}</h3>
9999
{% if release_files|has_gpg %}
100100
<th><a href="https://www.python.org/downloads/#gpg">GPG</a></th>
101101
{% endif %}
102+
{% if release_files|has_sha256 %}
103+
<th>SHA-256 checksum</th>
104+
{% elif release_files|has_md5 %}
105+
<th>MD5 checksum</th>
106+
{% endif %}
102107
</tr>
103108
</thead>
104109
<tbody>
@@ -107,8 +112,6 @@ <h3>{{ f.os.name }}</h3>
107112
<td><a href="{{ f.url }}">{{ f.name }}</a></td>
108113
<td>{{ f.os.name }}</td>
109114
<td>{{ f.description }}</td>
110-
<td>{{ f.md5_sum }}</td>
111-
<td>{{ f.sha256_sum|default:"n/a" }}</td>
112115
<td>{{ f.filesize|filesizeformat }}</td>
113116
{% if release_files|has_sigstore_materials %}
114117
{% if f.sigstore_bundle_file %}
@@ -124,6 +127,11 @@ <h3>{{ f.os.name }}</h3>
124127
{% if release_files|has_gpg %}
125128
<td>{% if f.gpg_signature_file %}<a href="{{ f.gpg_signature_file }}">SIG</a>{% endif %}</td>
126129
{% endif %}
130+
{% if release_files|has_sha256 %}
131+
<td>{{ f.sha256_sum }}</td>
132+
{% elif release_files|has_md5 %}
133+
<td>{{ f.md5_sum }}</td>
134+
{% endif %}
127135
</tr>
128136
{% endfor %}
129137
</tbody>

0 commit comments

Comments
 (0)