[Zope] Sending DB data via SESSION manager

Braun Brelin bbrelin@openapp.biz
Mon, 14 Apr 2003 14:04:18 +0100


[I originally sent this e-mail to the Zope-DB list, but in reviewing it, this
may be more  of a question for the general list]

Hello,

I've built a formulator form that connects to a database to populate many of the
fields in the form.  I'm using the MySQL DB adapter and I've written a python
script to access it and return the data via the SESSION Manager like so...

for (key,value) in recordset.items():
   context.REQUEST.SESSION.set(key,value)

This, however isn't precisely what I want.  If I create two separate instances
of the formulator form (i.e. I do a copy/paste from the master form object into
my own folder more than once)  The second form gets the same datavalues
automatically rendered into the field as the first form.   What I want, instead,
is in the SESSION object to set a dictionary where each key would be the form ID
and the value would be another dictionary containing the database field values.

How do I go about doing this?  I tried doing something like this:


context.REQUEST.SESSION.set(MyFormsDict,{})

but that fails with an "unhashable type" error.  
Is what I'm attempting even possible with the SESSION object?

Any thoughts?

Thanks,

Braun Brelin


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/