Jinja template_name should use "/" even on Windows (#1617)

Closes #1545. Thanks, Robert Christie
pull/1629/head
Robert Christie 2022-02-03 01:58:35 +00:00 zatwierdzone przez GitHub
rodzic b5e6b1a9e1
commit 1af1041f91
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -1212,9 +1212,10 @@ class DatasetteRouter:
else:
# Is there a pages/* template matching this 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:
template = self.ds.jinja_env.select_template([template_path])
template = self.ds.jinja_env.select_template([template_name])
except TemplateNotFound:
template = None
if template is None: