Reputation: 11
I have the following program rendering a very simple page.
from chameleon import PageTemplate
template_content = """
<html>
<head>
<title>${title}</title>
</head>
<body>
<h1 tal:condition="people.show_people and people.persons|False">People</h1>
<p tal:repeat="name people.persons">${name}</p>
<h2 tal:condition="not people.not_existing_prop|False">Condition People non-existing prop</h2>
<h3 tal:condition="not prop" tal:define="prop people.non_existing_prop|False">Define People non-existing prop</h3>
</body>
</html>
"""
template = PageTemplate(template_content)
people = {'show_people': True, 'persons': ['Rudi', 'Fritz']}
variables = {'title': 'Try to provoke TAL condition bug', 'people': people}
output = template(**variables)
print(output)
I can't figure out why tag in line 12 does not show up on the rendered html result. Why doesn't my condition condition="not people.not_existing_prop|False"
evaluate to True?
Asone see on line 13, tag, I found a workaround using 'define' but I still want to understand why line 12 behaves different than I expected it.
Upvotes: 0
Views: 28