warn/raise when a def/block is named "body"; document all reserved words on "self" namespace, etc.
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 Anonymous
Hi,
I was trying out mako and found a peculiar issue. If I have the name of a block as "body" the inheritance won't work. I am attaching the output of before and after ... this is a very simple example.
## layout.html
<title> Hello </title>
<%block name="body">Parent body </%block>
## show_entries.html
<%inherit file="layout.html" />
<%block name="body" >
Body of show entries
</%block>
Code for rendering
templ = temp_lookup.get_template('show_entries.html')
print templ.render()
Output :
In [64]: print templ.render()
Parent body
In [65]: print templ.render()
Parent body
In [66]: templ = temp_lookup.get_template('show_entries.html')
In [67]: print templ.render()
Parent body
After changing the name="body" to name="body_2" in both
In [68]: templ = temp_lookup.get_template('show_entries.html')
In [69]: print templ.render()
<title> Hello </title>
Body of show entries
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 issue with the minimal layout.html and show_entries.html templates in the report, rendering show_entries.html through temp_lookup. Compare the behavior of the block named "body" with "body_2". Done means the reserved-name behavior is explicitly handled and the reserved words for the self namespace are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100