Skip to content

Commit d81bf1f

Browse files
authored
Add more links back to PyPI (#84)
1 parent 8d97098 commit d81bf1f

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

inspector/main.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,12 @@ def distribution(project_name, version, first, second, rest, distname):
187187
links=file_urls,
188188
h2=f"{project_name}",
189189
h2_link=f"/project/{project_name}",
190+
h2_paren="View this project on PyPI",
191+
h2_paren_link=f"https://pypi.org/project/{project_name}",
190192
h3=f"{project_name}=={version}",
191193
h3_link=f"/project/{project_name}/{version}",
194+
h3_paren="View this release on PyPI",
195+
h3_paren_link=f"https://pypi.org/project/{project_name}/{version}",
192196
h4=distname,
193197
h4_link=f"/project/{project_name}/{version}/packages/{first}/{second}/{rest}/{distname}/", # noqa
194198
)
@@ -212,12 +216,18 @@ def file(project_name, version, first, second, rest, distname, filepath):
212216
return render_template(
213217
"code.html",
214218
code=contents,
215-
h2=f"{project_name}=={version}",
216-
h2_link=f"/project/{project_name}/{version}",
217-
h3=distname,
218-
h3_link=f"/project/{project_name}/{version}/packages/{first}/{second}/{rest}/{distname}/", # noqa
219-
h4=filepath,
220-
h4_link=f"/project/{project_name}/{version}/packages/{first}/{second}/{rest}/{distname}/{filepath}", # noqa
219+
h2=f"{project_name}",
220+
h2_link=f"/project/{project_name}",
221+
h2_paren="View this project on PyPI",
222+
h2_paren_link=f"https://pypi.org/project/{project_name}",
223+
h3=f"{project_name}=={version}",
224+
h3_link=f"/project/{project_name}/{version}",
225+
h3_paren="View this release on PyPI",
226+
h3_paren_link=f"https://pypi.org/project/{project_name}/{version}",
227+
h4=distname,
228+
h4_link=f"/project/{project_name}/{version}/packages/{first}/{second}/{rest}/{distname}/", # noqa
229+
h5=filepath,
230+
h5_link=f"/project/{project_name}/{version}/packages/{first}/{second}/{rest}/{distname}/{filepath}", # noqa
221231
)
222232
else:
223233
return "Distribution type not supported"

inspector/templates/base.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ <h4>
3333
{{ h4 }}
3434
{% endif %}
3535
</h4>
36+
<h5>
37+
{% if h5_link %}
38+
<a href="{{ h5_link }}">{{ h5 }}</a>
39+
{% else %}
40+
{{ h5 }}
41+
{% endif %}
42+
</h4>
3643
{% block body %}{% endblock %}
3744
</body>
3845
<footer>

0 commit comments

Comments
 (0)