mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Jinja template_name should use "/" even on Windows (#1617)
Closes #1545. Thanks, Robert Christie
This commit is contained in:
parent
b5e6b1a9e1
commit
1af1041f91
1 changed files with 3 additions and 2 deletions
|
|
@ -1212,9 +1212,10 @@ class DatasetteRouter:
|
||||||
else:
|
else:
|
||||||
# Is there a pages/* template matching this path?
|
# Is there a pages/* template matching this path?
|
||||||
route_path = request.scope.get("route_path", request.scope["path"])
|
route_path = request.scope.get("route_path", request.scope["path"])
|
||||||
template_path = os.path.join("pages", *route_path.split("/")) + ".html"
|
# Jinja requires template names to use "/" even on Windows
|
||||||
|
template_name = "pages" + route_path + ".html"
|
||||||
try:
|
try:
|
||||||
template = self.ds.jinja_env.select_template([template_path])
|
template = self.ds.jinja_env.select_template([template_name])
|
||||||
except TemplateNotFound:
|
except TemplateNotFound:
|
||||||
template = None
|
template = None
|
||||||
if template is None:
|
if template is None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue