[ZPT] Re: Fwd: Re: sql not that persistent

Chris Withers chrisw@nipltd.com
Sun, 28 Jul 2002 09:13:40 +0100


Michal Kurowski wrote:
>>   "REQUEST.set('my_result', sql_result())" (DTML, similar for ZPT).
> 
> Yes, and that's the place that is a bit mysterious to me.

Well, this is stylisticly horrible so I'm glad it doesn't work. ;-)
Logic shouldn't be in your presentation layer...

If you really need to do this, then have your page rendered by a python 
script which uses your page template:

context.REQUEST.set('my_result',context.sql_result())
return context.your_page_template()

> for key, item in request.items():
>     print ...
> 
> there's no such thing set :-(

Be careful, REQUEST only smells like a dictionary...

try:
for key,item in context.REQUEST.other.items():
  ...

> Isn't that only strings can be placed in those session/request
> dictionaties ?

Nope, you can shove anything in the session or the the request.

Bear in mind that the SESSION lasts as long as the browser keeps sending 
  back the session cookie. The REQUEST only last as long as each HTTP 
request, so you can't put something in here and expect it to be there 
some time later when you're rendering another page...

cheers,

Chris

> 
>