[Zope] Doubt about the ZPT example in Using Zope Page Templates

Dieter Maurer dieter@handshake.de
Fri, 27 Jun 2003 20:14:28 +0200


Josef Meile wrote at 2003-6-27 12:11 +0200:
 > ...
 > So, I
 > discovered
 > that it could solved replacing the line where the titles are written by this
 > one:
 > 
 > <td tal:content="python:item.title or default">No Title</td>
 > 
 > I still don't understand why this sintax doesn't work:
 > <td tal:content="python:item/title or default">No Title</td>

Because in Python "/" is the division operator. Therefore
"item/title" in Python is fundamentally different from
"item/title" as path expression.

I usually use in such cases

  <XXXX tal:define="title	item/title;"
        tal:content="python: title or default">....</XXXX>


Dieter