[ZPT] zpt compare repeat

Tino Wildenhain tino@wildenhain.de
Mon, 27 Jan 2003 19:53:14 +0100


Hi Jamie,

--On Montag, 27. Januar 2003 07:06 -0500 jamie@f-resource.com wrote:

> Hi,  ima newbie and maybe someone can give a hint please;)
>
> What I am trying todo is compare zopetime against a preinserted date
> in a sql table in the format xxxx/xx/xx
>
> So if the date is == to zope time all rows with the matching date are
> displayed.

Better you do it in the database. Why fetching results and throw them
away?

If you still have to do modifications on the data returned by ZSQL
methods, you should use a python script, which reads basically like this:

return [{'attr1':r.attrdata1,
         'attr2':somecalculations(r.attrdata2)} for r in 
context.yourZSQLMethod(..)]

in tal:repeat you can later access your data via iterator/attr1 and 
iterator/attr2

E.g.
<tr tal:repeat="item here/yourPythonScript">
  <td tal:content="item/attr1">Foo</td>
  <td tal:content="item/attr2">Bar</td>
</tr>

>
>
> <tr tal:condition="python:here.ZopeTime().strftime('%m/%d/%Y')==
> 'db/date'">
>
> <span tal:repeat="db here/selectallsched">
>
> or
>
>
>        <span tal:repeat="db here/selectallsched">
>
> <tr tal:condition="python:here.ZopeTime().strftime('%m/%d/Y') ==
> 'db/date'">
>
>
> neither work?
>
>
>
> Thank you;
>
>
>
>
>
>
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt