How can I save variables in a session
Well I'm not sure if the question is clear, what I want to do is to take some variables I recieve from a form and save them using dtml with all the session information and then read from there in the following pages. for exampe I want tosave there the field fx_in and then read it back in some other pages. _________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/
Hi - to store a value into a session variable use <dtml-call "REQUEST.SESSION.set('<key_name>', <value>)"> - to read, for example <dtml-let value_from_session="REQUEST.SESSION.get('<key_name>', <default>)"> ... <dtml-let> if there is no variable named <key_name>, then the value <default> is returned - to delete <dtml-call "REQUEST.SESSION.delete('<key_name>')"> - to test if there is a variable named <key_name> <dtml-let is_value_on_session="REQUEST.SESSION.has_key('<key_name>')"> ... </dtml-let> Hope this will help Dragos ----- Original Message ----- From: "Alexander Alvarado" <funalito@hotmail.com> To: <zope@zope.org> Sent: Tuesday, September 16, 2003 8:47 PM Subject: [Zope] How can I save variables in a session
Well I'm not sure if the question is clear, what I want to do is to take some variables I recieve from a form and save them using dtml with all the session information and then read from there in the following pages.
for exampe I want tosave there the field fx_in and then read it back in some other pages.
_________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/
_______________________________________________ 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 )
Unless you are using ZEO with multiple Zope clients behind squid and using a redirector. We found that the values seemed to stick to the client and would change back and forth with a page refresh. Using <dtml-var REQUEST> to watch this we were able to verify it. Since we found that out, we built our own sessioning tool using MySQL and seems to work well. We love ZEO and having the two clients makes things more stable and easier to work with but not having the built in sessioning machinery available was a bummer when we discovered that. Allen
Allen wrote:
Unless you are using ZEO with multiple Zope clients behind squid and using a redirector. We found that the values seemed to stick to the client and would change back and forth with a page refresh.
Indeed. Speak to Chris McDonough. You need to make your session storage a ClientStorage rather than a TemporaryStorage. I guess the corresponding storage on the server could still be a TemporaryStorage, but you'd have to ask Chris... cheers, Chris
In a python script: session = container.REQUEST.SESSION session.set('<name>') = value value = session.get('<name>') replace '<name>' with the string you want to associate the value with. You can pretty much treat the session as a dictionary. On Tue, 2003-09-16 at 12:47, Alexander Alvarado wrote:
Well I'm not sure if the question is clear, what I want to do is to take some variables I recieve from a form and save them using dtml with all the session information and then read from there in the following pages.
for exampe I want tosave there the field fx_in and then read it back in some other pages.
_________________________________________________________________ Charla con tus amigos en línea mediante MSN Messenger: http://messenger.yupimsn.com/
_______________________________________________ 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 ) -- Edward Muller - http://www.interlix.com - "Open Source Specialists" Dedicated Zope Hosting - Web Hosting - Open Source Consulting Network & PC Service & Support - Custom Programming Phone: 417-862-0573 - Cell: 417-844-2435 - Fax: 417-862-0572 Jabber: edwardam@jabber.interlix.com - AIM: edwardam453 - ICQ: 287033
participants (5)
-
Alexander Alvarado -
Allen -
Chris Withers -
Dragos Chirila -
Edward Muller