Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that get_template() template names should use / even on Windows #1578

Closed
simonw opened this issue Feb 3, 2022 · 1 comment
Closed

Comments

@simonw
Copy link
Contributor

simonw commented Feb 3, 2022

I got caught out by this recently. The only mention I could find of this was in this comment: #1378 (comment)

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

@simonw
Copy link
Contributor Author

simonw commented Feb 3, 2022

I think the best place to document it is here:

@internalcode
def get_template(
self,
name: t.Union[str, "Template"],
parent: t.Optional[str] = None,
globals: t.Optional[t.MutableMapping[str, t.Any]] = None,
) -> "Template":
"""Load a template by name with :attr:`loader` and return a
:class:`Template`. If the template does not exist a
:exc:`TemplateNotFound` exception is raised.
:param name: Name of the template to load.

@davidism davidism closed this as completed Mar 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants