tal:content="<expr>" where <expr> evaluates to None omits tag
Bug #379769 reported by
Sidnei da Silva
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Chamelon Core |
Fix Released
|
Medium
|
Malthe Borch | ||
Launchpad itself |
Invalid
|
Medium
|
Sidnei da Silva |
Bug Description
If you have an expression that evaluates to None, the tag will be omitted from the output. This is problematic, especially when used with tables, which is pretty common. Consider this for example:
<tr>
<td>Attribute 1</td>
<td>Attribute 2</td>
</tr>
<tr tal:repeat="item view/foo">
<td tal:content=
<td tal:content=
</tr>
In this case, if any of (attribute1, attribute2) is None, the <td> will be omitted, causing a broken table to be generated. There are easy workarounds, but the behaviour is surprising and not backwards compatible, and we should opt for the path of least surprise.
Changed in chameleon.core: | |
assignee: | nobody → Malthe (mborch) |
importance: | Undecided → Medium |
Changed in launchpad: | |
assignee: | nobody → Sidnei da Silva (sidnei) |
importance: | Undecided → Medium |
affects: | launchpad → launchpad-foundations |
Changed in chameleon.core: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
One compromise, which makes more sense to me is to render this as a self-closing tag, <td />. This enables developers to realize what happened and guard against it.
However, it may be that for z3c.pt, we should have the ZPT behavior.
\malthe