Template.imports can break cache reload.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 459
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Description
Migrated issue, originally created by Cody Taylor (@CodeMan99)
When moving an importable name out of a template context and add it to the imports instead the source template does not change, but the rendered module does.
This should be documented at very least.
The easiest solution I can think of is to render the imports argument as a fake template. If the fake template is invalidate, set a flag to invalidate all the template source files we are aware of, particularly in the TemplateLookup case.
Potentially, we could actually import the imports and add that to the context, but that is also a work-around that would need documented. Though users shouldn't attempt to provide a context name that they are already importing anyway.
(willing to work on this provided buy-in on any of the proposals)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the cache-reload behavior when an importable name moves into Template.imports without changing the source template. Inspect the Template.imports and TemplateLookup paths, then review the discussion's proposed fake-template and context-import approaches. Done requires an agreed fix or documented behavior for rendered-module invalidation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100