[Zope] sessions and zsql methods again!
Alejandro Fernandez
shomon@softhome.net
Tue, 2 Jul 2002 12:42:01 +0200
Hi,
I want to "SELECT CAR,MOTOR,VENDOR FROM TBL_CAR WHERE CAR_ID=<dtml-sqlvar
intCarId>" (note the suave lezynsky-reddick namings!) - and get that into
a list of dicts, so I can then output it all in a dtml-in with sequence
iteration parameters.
Would this be something like
session=context.REQUEST.SESSION
ld=[]
ld=qryGetCarInfo(car_id=session['car_id'])
for x in ld:
entry={}
entry["car"]=x[0]
entry["motor"]=x[1]
entry["vendor"]=x[2]
ld.append(entry)
session['dbgrabs']=ld
It's a lot of data I need to grab in about 14 different queries... I'm
using the SESSION namespace to hold the values, so I'm thinking of
grabbing all these values from the database before I generate individual
output pages("loading... please wait"), or even better, somehow grabbing
them a little at a time as the user browses the pages, and deleting the
info at the end of a session, or when another CAR_ID is accessed.
I know the session stuff doesn't have a guide yet, and there's no one
answer to all this, but I thought posting here might be a source of
helpful tips, and there might be others who are doing this kind of thing
too. Are there any gotchas I should know about? Can I for example, somehow
commit information as it's gathered, or do I have to build loops that
store the info and set a boolean value at the end, to give a little hope
that the info has been gathered?
Thanks very much!
Ale
--
Alejandro Fernandez
Electronic Group Interactive
--+34-65-232-8086--