[ZPT] Re: Fwd: Re: sql not that persistent
Michal Kurowski
michal@poczta.gazeta.pl
Fri, 26 Jul 2002 22:04:10 +0200
Dieter Maurer [dieter@handshake.de] wrote:
> Michal Kurowski writes:
> > ...
> > sql method iterated on five tables ( some scripts involved etc)
> > |
> > \|/
> > zpt: tal:repeat on each of the tables
> > |
> > \|/
> > zpt: tal:repeat on rows from those tables
> > |
> > \|/
> > zpt: link to a script
> > |
> > \|/
> > script: performing an action on fields from that second iteration
> > and trying to access values from the first iteration
> >
> > As I said: I can access the values (from the "second iteration")
> > directly through parameters but I still have to do some sql
> > in the script later on.
> Z SQL results live as long as they are referenced.
> They disappear at least when the request is finished.
>
> You can bind them to names:
>
> <dtml-let my_result=sql_result>...</dtml-let> (DTML)
>
> or
>
> <... tal:define="[global] my_result here/sql_result">... (ZPT)
>
> or put them into the request object
>
> "REQUEST.set('my_result', sql_result())" (DTML, similar for ZPT).
Yes, and that's the place that is a bit mysterious to me.
Let's say I have a global "table" variable defined in ZPT that points
to "here.get_db()".
When I try:
tal:content="python: request.set('my_table', table)"
or
tal:content="python: request.set('my_table', here.get_db())
and then, in a script:
for key, item in request.items():
print ...
there's no such thing set :-(
Obviously, I am missing something major in here.
Isn't that only strings can be placed in those session/request
dictionaties ?
--
Michal Kurowski
<michal@poczta.gazeta.pl>