[Zope] Session set/read in same request
Dan Fairs
monster at spiderplant.net
Mon Sep 13 14:00:11 EDT 2004
Hi,
I'm trying to set and then read a session variable on the same request.
Basically, I have a script which sets a session variable when called, and
then redirects back to a content item. That item's __bobo_traverse__ then
looks for this variable.
Trouble is, the variable I'm setting doesn't seem to be present when I
check it.
My 'setter' script looks like this:
if response == '1':
context.REQUEST.SESSION['secure_acknowledge'] = 1
context.REQUEST.RESPONSE.redirect(site.absolute_url())
The relevant lines in the site __bobo_traverse__ are:
response = self.REQUEST.RESPONSE
if not self.REQUEST.SESSION.has_key('secure_acknowledge'):
zLOG.LOG(__name__, 0, "no ack")
cr = self.portal_url.getPortalObject()[CONTENT_ROOT_NAME]
response.redirect(cr.absolute_url() + '/secure_site_notice?came_from=%s'
% self.UID())
else:
zLOG.LOG(__name__, 0, "ack")
... I always end up with 'no ack' in my log.
If I dump the contents of the SESSION just after the variable is set, then
I can see it - but it's gone by the time I actually want to process it!
What am I doing wrong?
Cheers,
Dan
More information about the Zope
mailing list