help on loop variables

Tim Arnold <[email protected]> Tue, 28 Jun 2011 14:53:11 -0400
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
As far as I can tell, it is impossible to use $varExists() inside a
loop variable. So I'm asking for help on how to re-think my situation.

First, here's what will not work in Cheetah. varExists is always false:
#for $row in $here
  <tr>
  #for $cell in $row
    #if $varExists('cell.isHeader') and $cell.isHeader
    <th style=3D"$cell.style.inline">${cell}</th>

Second, here is a similar template, but written in SimpleTal that does work:
<metal:block tal:repeat=3D"cell row">
    <th tal:condition=3D"cell/isHeader"
           tal:attributes=3D"style cell/style/inline;
           tal:content=3D"cell"></th>
</metal:block>

I have some table cells with a varying suite of attributes; where
those attributes exist I want to use them, and of course I don=92t want
to get an error when trying to use a non-existent attribute.

Finally, my question:
is there any way to accomplish this with a Cheetah template?

thanks,
--Tim Arnold

---------------------------------------------------------------------------=
---
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security =

threats, fraudulent activity, and more. Splunk takes this data and makes =

sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2