[Zope] Keeping data throughout a session

Small Business Services toolkit at magma.ca
Fri Mar 12 10:29:09 EST 2004


There is probably a more elegant solution, but this might work:

Create a dictionary on the user_folder (a property field on this folder is stored in RAM for fast access).

Store the users HTTP_X_FORWARDED_FOR ip address as the 'key' for the dictionary (display REQUEST and you will see that this field doesn't change if the user spawns several browsers from the same pc/internet connection, however it will change if the user comes from different pc/internet connections). 

You can then see if any given user is already registered, and you can store a list containing the fields you want to save as the 'value' for the dictionary key.

HTH

Jonathan
  ----- Original Message ----- 
  From: Michael.Rinner at cellzome.com 
  To: zope at zope.org 
  Sent: March 12, 2004 9:52 AM
  Subject: [Zope] Keeping data throughout a session



  Hi, 

  I've got the following problem: 

  I want to keep several choices users make during a site visit persistent in memory during their session. Not all of those fields appear on each page or are needed, but the values should still be available all the time so they can be used for various selections. 

  Now I could simply use hidden input fields and carry the values over and over from one page to another, but that seems quite an awkward way to do this. So I store them as Session data, which works fine so far except for if a user opens several browser windows, which however happens quite often. In that case, changes done in one window affect the selection in another window, as there is only one shared session object obviously. 

  Does anyone have an idea what the best way would be to handle this? I'd like to automatically keep values valid that are selected at random times for seperate windows and their subwindows, without affecting values stored for other windows. And all of that hopefully without major changes to various places in the DTML and script files... 

  Thanks in advance, 

  Michael Rinner


------------------------------------------------------------------------------


  _______________________________________________
  Zope maillist  -  Zope at 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 )

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20040312/272de9f2/attachment.html


More information about the Zope mailing list