On 13 Mar 2006, at 22:53, Jeff Gentry wrote:
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 :)
What do you get AttributeError on actually? What line? The code above looks just fine. Are you perhaps trying to do session ['last view'] somewhere else without checking that it first exists?
_______________________________________________ Zope maillist - Zope@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 )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com