[ZPT] Yuk! Someone please improve on this...

Ron Bickers rbickers-dated-1000736414.b726e0@logicetc.com
Mon, 10 Sep 2001 10:20:14 -0400


> > Can someone help me turn:
> >
> > <td><dtml-var title null="&nbsp;"></td>
> >
> > ...into ZPT?
>
> This works:
>
>   <td tal:define="title item/title"
>       tal:content="structure python:title or '&nbsp;'">Title</td>
>
> ...but I feel a bit sick now.

So did I when this is what I thought I had to do.  I believe you can do:

  <td tal:content="structure python:item.title or '&nbsp;'">Title</td>

and avoid the define, but one problem with this method is that using
'structure' on the title would break titles like 'This is a <cool> title.',
since it wouldn't quote the < and >.

Not very happily, I ended up doing this:

  <td tal:content="item/title | default">&nbsp;</td>

That works, but it eliminates the benefit of having sample data in the cell.

Is there a way to specify structure on just the &nbsp; in the example above
and not the title, or should this whole thing be done differently?
_______________________

Ron Bickers
Logic Etc, Inc.