tornadoweb / tornadoweb/tornado
Module importing in templates must be block-local
Open
Nobody has claimed this yet.
template
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Description
Modules imported with {% import <module> %} outside a block cannot be used inside it - they must be imported within its scope. I would expect imports at file scope to be available to all blocks.
{% import os %}
{{os}} {% comment "works" %}
{% block "block" %}
{{os}} {% comment "error" %}
{% import os %}
{{os}} {% comment "works" %}
{% end %}
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 locating Tornado's template handling for {% import %} and {% block %} scope, then reproduce the behavior with the template shown in the issue. Done means an import at file scope is available inside blocks while block-local imports continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100