I don't know exactly how to do this with formulator, but the SESSION object implements all the methods that a dictionary does. Which means you can for all intents and purposes access it like a dictionary. The 'update' method might be what you want here. On Mon, 2003-04-14 at 09:04, Braun Brelin wrote:
[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/
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )