Skip to content

Ensure template_path always uses "/" to match jinja#1617

Merged
simonw merged 2 commits intosimonw:mainfrom
cb160:templates_on_windows
Feb 3, 2022
Merged

Ensure template_path always uses "/" to match jinja#1617
simonw merged 2 commits intosimonw:mainfrom
cb160:templates_on_windows

Conversation

@cb160
Copy link
Contributor

@cb160 cb160 commented Feb 1, 2022

This PR shoudl fix #1545

The existing code substituted / for , assuming this was the right behaviour for windows. But on Windows, Jinja still uses / for the template list - See https://github.com/pallets/jinja/blob/896a62135bcc151f2997e028c5125bec2cb2431f/src/jinja2/loaders.py#L225

@simonw simonw changed the title Ensure template_path always uses "/" to match jina Ensure template_path always uses "/" to match jinja Feb 2, 2022
@codecov
Copy link

codecov bot commented Feb 2, 2022

Codecov Report

Merging #1617 (af293c9) into main (2aa686c) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1617      +/-   ##
==========================================
+ Coverage   92.09%   92.16%   +0.06%     
==========================================
  Files          34       34              
  Lines        4518     4531      +13     
==========================================
+ Hits         4161     4176      +15     
+ Misses        357      355       -2     
Impacted Files Coverage Δ
datasette/app.py 95.37% <100.00%> (ø)
datasette/views/table.py 96.19% <0.00%> (ø)
datasette/utils/__init__.py 94.79% <0.00%> (+<0.01%) ⬆️
datasette/views/base.py 95.49% <0.00%> (+0.07%) ⬆️
datasette/views/special.py 95.09% <0.00%> (+2.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2aa686c...af293c9. Read the comment docs.

@simonw
Copy link
Owner

simonw commented Feb 3, 2022

Aha I understand the problem now! pallets/jinja#1378 (comment)

Jinja template names/paths are not always filesystem paths. So regardless of the OS Jinja always uses forward slashes.

@simonw
Copy link
Owner

simonw commented Feb 3, 2022

I was hoping to get the test suite running on Windows before merging this PR but that looks like it will be a BIG job, see:

So I'm going to merge this one as-is for the moment.

@simonw simonw merged commit 1af1041 into simonw:main Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom pages don't work on windows

2 participants