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 :)
Are cookies enabled? If not, should be. what does request look like <dtml-var REQUEST> Is SESSION presnt? On Mon, 13 Mar 2006, 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 :)
_______________________________________________ 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 )
--
Are cookies enabled? If not, should be.
Yes. I should also note that I've tried this on two different machines (connecting to both instances).
what does request look like <dtml-var REQUEST> Is SESSION presnt?
Well, on the good Zope instance the first few lines of REQUEST look pretty good: form cookies tree-s 'eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuxEQ9AIOOB9Q' __cp 'x%DA%D3%60b%60%60%C8%04b%86hF%20%A1%01%E2%16%83%B8%C5%3C%40%22%3F%AF%24%DF-55%25%2919%1B%00W%E7%06%D1' _ZopeId '07894127A2QSmdNEV4g' lazy items SESSION <bound method SessionDataManager.getSessionData of <SessionDataManager at /session_data_manager>> But on the broken one I get: form -C '' cookies tree-s 'eJzTyCkw5NLIKTDiClZ3hANXW3WuAmOuxEQ9AIOOB9Q' __cp 'x%DA%D3%60b%60%60%C8%04b%86hF%20%A1%C1%0C%24J%40%DCb6%20%91%9F%1A%92Z%5CR%C2%0Dd%26%A6%A4%B8%A5%A6%A6%24%25%26g%03%00%9C%D2%09%29' lazy items Note that the broken instance (I'll call it 'b' and the good one 'a') also has /session_data_manager and it is configured identically to the one on A. Also, the last time I used something SESSION based it was working (which is why I figure that I've managed to hose something up along the way).
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:
To follow up on this, I'm not sure why there was a problem here but I ended up deleting & re-adding the session data manager. Should have been one of the first things I tried, but .... Anyways, it works now. Thanks
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
Peter Bengtsson wrote at 2006-3-15 22:02 +0000:
... 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?
The reported problem looks as if the REQUEST were used after it has been closed. This can for example happen when an acquisition wrapper is cached in a "_v_" variable. The wrapper has at its bottom a stale REQUEST object, now closed. A closed REQUEST has lost all content of its "other", among them "SESSION". -- Dieter
participants (4)
-
Dennis Allison -
Dieter Maurer -
Jeff Gentry -
Peter Bengtsson