Skip to content

Commit 72dbbc5

Browse files
committed
tmp
1 parent b8af421 commit 72dbbc5

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

pulp_python/app/tasks/publish.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from pulp_python.app import models as python_models
1212
from pulp_python.app.serializers import PythonPublicationSerializer
13-
from pulp_python.app.utils import write_simple_index, write_simple_detail
13+
from pulp_python.app.utils import write_simple_index, write_simple_detail2
1414

1515

1616
log = logging.getLogger(__name__)
@@ -119,7 +119,7 @@ def write_project_page(name, simple_dir, package_releases, publication):
119119

120120
with open(metadata_relative_path, "w") as simple_metadata:
121121
# todo?
122-
simple_metadata.write(write_simple_detail(name, package_releases))
122+
simple_metadata.write(write_simple_detail2(name, package_releases))
123123

124124
project_metadata = models.PublishedMetadata.create_from_file(
125125
relative_path=metadata_relative_path,

pulp_python/app/utils.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,21 @@
4848
</html>
4949
"""
5050

51+
simple_detail_template2 = """<!DOCTYPE html>
52+
<html>
53+
<head>
54+
<title>Links for {{ project_name }}</title>
55+
<meta name="api-version" value="2" />
56+
</head>
57+
<body>
58+
<h1>Links for {{ project_name }}</h1>
59+
{% for name, path, sha256 in project_packages %}
60+
<a href="{{ path }}#sha256={{ sha256 }}" rel="internal">{{ name }}</a><br/>
61+
{% endfor %}
62+
</body>
63+
</html>
64+
"""
65+
5166
DIST_EXTENSIONS = {
5267
".whl": "bdist_wheel",
5368
".exe": "bdist_wininst",
@@ -426,6 +441,13 @@ def write_simple_detail(project_name, project_packages, streamed=False):
426441
return detail.stream(**context) if streamed else detail.render(**context)
427442

428443

444+
def write_simple_detail2(project_name, project_packages, streamed=False):
445+
"""Writes the simple detail page of a package."""
446+
detail = Template(simple_detail_template2)
447+
context = {"project_name": project_name, "project_packages": project_packages}
448+
return detail.stream(**context) if streamed else detail.render(**context)
449+
450+
429451
def write_simple_index_json(project_names):
430452
"""Writes the simple index in JSON format."""
431453
return {

0 commit comments

Comments
 (0)