#56 closed defect (fixed)
First template inclusion hides variables for next include
Reported by: | sakkew | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.3.1 |
Component: | Template processing | Version: | 0.3 |
Keywords: | Cc: |
Description
Using /root/branches/stable/0.3.x/examples/turbogears as base, I added another include to welcome.html:
<xi:include href="include.html" py:for="name in ('foo', 'bar', 'baz')" />
Now when I try to access variables set in the include tag from within include.html, nothing is displayed. If I remove the original <xi:include href="base.html" /> from the top of welcome.html, it works.
Another related issue is that if base.html is included, the body of base.html is rendered as many times as the second include iterates.
Attached are the example files.
Attachments (3)
Change History (7)
Changed 18 years ago by sakkew
Changed 18 years ago by sakkew
Changed 18 years ago by sakkew
comment:1 Changed 18 years ago by cmlenz
- Resolution set to invalid
- Status changed from new to closed
comment:2 Changed 18 years ago by cmlenz
- Milestone set to 0.4
- Resolution invalid deleted
- Status changed from closed to reopened
The other issue noted here is valid: The $name variables in the included file are not substituted by the respective values set up in the py:for loop.
I'm looking into this.
comment:3 Changed 18 years ago by cmlenz
- Resolution set to fixed
- Status changed from reopened to closed
- Version set to 0.3
This should be fixed in [321].
comment:4 Changed 18 years ago by cmlenz
- Milestone changed from 0.4 to 0.3.1
This happens because the included file (include.html) wraps its content in a <body> tag. The <body> tag is matched by the py:match="body" rule in master.html, which then adds all the chrome around the included content.
Simply remove the <body> element or strip it from the output: <body py:strip="">.