[Zope] Session scoped variables

Joh Johannsen jojo@farm9.com
Fri, 04 May 2001 07:02:16 -0700


Install the CoreSessionTracking product

1. create Session Id Manager at highest level you might ever need
sessions, use default values (i.e. ignore the options it presents to
you, just click "Add")

2. create Session Data Manager in the same folder, give it the name
"whyDoIhaveToCreateThisThing"

3. in your standard_html_header (or someplace called by every page,
add):

<dtml-call
"REQUEST.set('sessionData',whyDoIhaveToCreateThisThing.getSessionData())">

otherwise you have to do:

  <dtml-with whyDoIhaveToCreateThisThing>
   <dtml-let sessionData=getSessionData>
    ...now I have a sessionData object!
   </dtml-let>
  </dtml-with>

After these three steps, you basically have the equivalent of the much
easier to comprehend SQLSession interface (SQL session not as complete
however, to get it working you have to create database tables and
implement garbage collection ... with core session, nothing left to do)

   sessionData.get('key')
   sessionData.set('key',value)
   sessionData.delete('key')
   sessionData.has_key('key')


Regards,

JJ

Tommy Johnson wrote:
> 
> Ok, now I have another question. How do you maintain state within Zope? I'm
> particularly interested in session scoped variables. Currently I'm trying to
> learn Zope by building an e-commerce application, and in all other
> languages, (ASP, ColdFusion, etc...) you have session scope available to you
> in order to track individual users, their individual shopping carts,
> customer info, etc.
> 
> I haven't been able to find anything yet for Zope. It isn't something like
> SESSION.(whatever) is it?
> 
> Also, does anyone know of a place that may have working examples of things
> of this nature. I'm thinking of publishing something like that (trials,
> discoveries, obstacles, how I solved them, and the like) after I complete
> this application. If I had something like that, it would benefit me greatly,
> so if there isn't anything out there ...
> 
> Thanks in advance,
> Tommy
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )