David Johnson wrote:
> Has anyone had experience with sessions?  What's the easiest way to
> use/access them?  As example, I'm building an eCommerce application and end
> anonymous users will be browsing the catalog and adding products and
> options.

Sessions are very simple in z3.

from zope.app.session.interfaces import ISession

session_data = ISession(request)[your_application_id]

Now access your session data via the dictionary, ie.

shopping_card = session_data['shopping_card']

In a view class it would look like this:

class YourView(object):

     def __init__(self, context, request):
           self.context = context
           self.request = request
           self.session_data = ISession(request)['your_application_id']

Have a look at zope.app.session.interfaces.ISession and in srichter's

Zope3-users mailing list

Reply via email to