[ZPT] sql not that persistent

Michal Kurowski michal@genesilico.pl
Thu, 25 Jul 2002 18:33:27 +0200


Hi,

I'm still rather a newbie in a Zope world but my expectations are 
high ;-).

I managed to develop rather nice zope/sql app and there's one thing 
I would like  to know.

Are sql results objects persistent ?

When I render results of a few sql methods in a ZPT defining repeats
on two levels is it possible to get access to that object later ?

I investigated the "request" and decided I'd use "session" to store 
thing I need but still I have to perform (very similar) sql methods
several times very often.

For example:

ZPT:
 
<div tal:repeat="row python: item[1]" tal:omit-tag="">
 <div tal:condition="python: row[0]" tal:omit-tag="">
   <tr tal:define="oddrow repeat/row/odd" tal:attributes="class
   python:test(oddrow, 'white', 'grey')" nowrap>
    <td nowrap width="80"><span tal:replace="python: row[0]">name</span></td>
    <td nowrap width="80" align="center"><span tal:replace="python: row[1]">score</span></td>
    <td nowrap ><font face="courier, sans-serif" size="2px"><span tal:replace="structre python:here.aminoacids(row[3],row[2],query[0]['seq'])" tal:omit-tag="">what goes around comes around</span></font></td>
    <td bgcolor="#FFFFFF"><a href tal:attributes="href string:${here/give_modeller_a_chance/absolute_url}?arg=$row"><span tal:replace="structure root/meta/images/modeller">mod alignment link</span></a></td>
    </tr>
   </div>
  </div>


And I have a "give_modeller_a_chance" script that is supposed to 
perform some action on things present on row. That's ok, I can 
pass it as an argument.

But what would happen if a "row" belongs to some bigger thing and
for example is also a variable defined in a "tal:repeat" statement ?

All I can do at the moment is to "remember" important things in a 
session and then do my sql query once again.

Any hints ? Aqusition ?

-- 
Michal Kurowski
<michal@genesilico.pl>