Skip to content

Commit 5b68d0d

Browse files
committed
fix: render_static works pre python 3.13
Signed-off-by: James McCorrie <[email protected]>
1 parent e0958eb commit 5b68d0d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dvsim/templates/render.py

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

1111
from collections.abc import Mapping
1212
from importlib import resources
13+
from pathlib import Path
1314

1415
from jinja2 import Environment, PackageLoader, select_autoescape
1516

@@ -28,9 +29,11 @@ def render_static(path: str) -> str:
2829
string containing the static file content
2930
3031
"""
32+
full_path = Path("dvsim/templates/static") / path
33+
3134
return resources.read_text(
32-
"dvsim",
33-
f"templates/static/{path}",
35+
".".join(full_path.parts[:-1]), # Module path
36+
full_path.name,
3437
)
3538

3639

0 commit comments

Comments
 (0)