[Zope] AttributeError on SESSION

Jeff Gentry jgentry at jimmy.harvard.edu
Mon Mar 13 17:53:07 EST 2006


Okay ... I figure I've probably managed to really hose up my Zope instance
somehow but I can't figure out what it would be.  Whenever I'm trying to
access the SESSION data, I get an AttributeError on SESSION.  This used to
work for me and on another Zope instance I have it does indeed work.  I
used the session test PythonScript from The Zope Book, as follows:

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'
    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' 
session['last view']=context.ZopeTime()
return 'This is your first view'

(well, I actually started with other code, but this causes the same
issue). 
This works as advertised in my other instance but throws the same
AttributeError on my first instance.  I'm assuming that I managed to
delete and/or edit something important without realizing it.  I did some
web searches on this but didn't really turn up anything, pretty much
everything I found assumed that SESSION was working :)




More information about the Zope mailing list