File tree 1 file changed +13
-2
lines changed 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 10
10
11
11
def render_simple_detail (project , request , store = False ):
12
12
context = _simple_detail (project , request )
13
- dir_name = os .path .join (os .path .dirname (warehouse .__file__ ), "templates" )
14
13
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" )
15
17
env = Environment (
16
18
loader = FileSystemLoader (dir_name ),
17
19
extensions = [],
18
20
cache_size = 0 ,
19
21
)
22
+
20
23
template = env .get_template ("legacy/api/simple/detail.html" )
21
24
content = template .render (** context , request = request )
22
25
23
26
content_hasher = hashlib .blake2b (digest_size = 256 // 8 )
24
27
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 )
You can’t perform that action at this time.
0 commit comments