Skip to content

Commit b4f35ca

Browse files
committed
add todoz
1 parent 08e7351 commit b4f35ca

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

warehouse/packaging/utils.py

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

1111
def render_simple_detail(project, request, store=False):
1212
context = _simple_detail(project, request)
13-
dir_name = os.path.join(os.path.dirname(warehouse.__file__), "templates")
1413

14+
# TODO: use pyramid_jinja2 "get_jinja2_environment" method instead:
15+
# https://docs.pylonsproject.org/projects/pyramid_jinja2/en/latest/api.html#pyramid_jinja2.get_jinja2_environment
16+
dir_name = os.path.join(os.path.dirname(warehouse.__file__), "templates")
1517
env = Environment(
1618
loader=FileSystemLoader(dir_name),
1719
extensions=[],
1820
cache_size=0,
1921
)
22+
2023
template = env.get_template("legacy/api/simple/detail.html")
2124
content = template.render(**context, request=request)
2225

2326
content_hasher = hashlib.blake2b(digest_size=256 // 8)
2427
content_hasher.update(content.encode("utf-8"))
25-
return (content_hasher.hexdigest().lower(), content)
28+
content_hash = content_hasher.hexdigest().lower()
29+
simple_detail_path = f"/simple/{project.normalized_name}/{content_hash}/"
30+
31+
if store:
32+
# TODO: Store generated file in FileStorage
33+
# We should probably configure a new FileStorage for a new simple-files bucket in GCS
34+
pass
35+
36+
return (content_hash, simple_detail_path)

0 commit comments

Comments
 (0)