[Zope] SESSION

Robert Jean robertjean2@yahoo.com
Mon, 21 Jul 2003 14:47:23 -0700 (PDT)


Hello,

I was trying the following script given in the Zope
Book 2.6 (I am running Zope 2.6 on Windows):

## Script (Python) "sessionTest"
secs_per_day=24*60*60
session=context.REQUEST.SESSION
if session.has_key('last view'):
    # The script has been viewed before, since the
'last view'
    # has been previously set in the session.
    then=session['last view']
    now=context.ZopeTime()
    session['last view']=now # reset last view to now
    return 'Seconds since last view %.2f' % ((now -
then) * secs_per_day)
# The script hasn't been viewed before, since there's
no 'last
# view' in the session data. 
session['last view']=context.ZopeTime()
return 'This is your first view'

I get the following error:

Error Type: KeyError
Error Value: SESSION

My session_data_manager has the following (default)
setting:

Place SESSION in REQUEST object as: SESSION

Also, cookies are enabled. They are displayed when I
do <dtml-var REQUEST>, but this snippet prints "not
set" despite the fact that "foo" shows up among the
cookies in DTML:

if container.REQUEST.RESPONSE.cookies.has_key('foo'):
  print "set"
else:
  print "not set"

Any idea of what may be wrong?

Thanks,
Robert

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com