File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,18 @@ async def web_modules_file(request: HttpRequest, file: str) -> HttpResponse:
25
25
26
26
# Fetch the file from cache, if available
27
27
last_modified_time = os .stat (path ).st_mtime
28
- cache_key = create_cache_key ("web_module " , str (path ).lstrip (str (web_modules_dir )))
29
- response = await caches [REACTPY_CACHE ].aget (
28
+ cache_key = create_cache_key ("web_modules " , str (path ).lstrip (str (web_modules_dir )))
29
+ file_contents = await caches [REACTPY_CACHE ].aget (
30
30
cache_key , version = int (last_modified_time )
31
31
)
32
- if response is None :
32
+ if file_contents is None :
33
33
async with async_open (path , "r" ) as fp :
34
- response = HttpResponse ( await fp .read (), content_type = "text/javascript" )
34
+ file_contents = await fp .read ()
35
35
await caches [REACTPY_CACHE ].adelete (cache_key )
36
36
await caches [REACTPY_CACHE ].aset (
37
- cache_key , response , timeout = None , version = int (last_modified_time )
37
+ cache_key , file_contents , timeout = 604800 , version = int (last_modified_time )
38
38
)
39
- return response
39
+ return HttpResponse ( file_contents , content_type = "text/javascript" )
40
40
41
41
42
42
async def view_to_component_iframe (
You can’t perform that action at this time.
0 commit comments