I'll bet it's an unfortunate timing issue caused by your use of OneShot,
which has to load and save the session on each request.  The redirect
results in an immediate new copy of OneShot being fired up, which probably
reads in the old values from disk before the new values have been saved to
disk.

Switch to WebKit.cgi (and the Memory or Dynamic session store) and see if
the problem goes away.

- Geoff

> -----Original Message-----
> From: Edmund Lian [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 20, 2002 3:11 PM
> To: Chuck Esterbrook
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Webware-discuss] Understanding sessions
> 
> 
> 
> Chuck wrote:
> 
> >That sounds like a bug to me. Can you provide a minimal example that
> >recreates it? We'll also need to know version, adapter, etc.
> 
> OK, here's a cut-down version of what I'm doing...
> 
> Versions: Python 2.2, Webware 0.7, Cheetah 0.9.13a1, using 
> OneShot.cgi on
> Apache
> 
> The snippets appended below result in a redirect, but the 
> session store is
> not cleared. However, if I call the clearSessionStore method 
> directly in
> the Cheetah template via $f.clearSessionStore(), things work 
> as expected.
> 
> ...Edmund.
> 
> 
> 
> ====================
> (1) Cheetah template
> 
> #from PageTemplate import PageTemplate
> #from WebFormDefinitions import MyForm
> #extends PageTemplate
> 
> #def main
> #compiler useNameMapper = 0
> #set $f = MyForm($self.$transaction)
>     ...<stuff>...
>     $f.processStuff()
> #end main
> 
> ====================
> (2) WebFormDefinitions
> 
> from Library import BaseForm
> 
> class MyForm(BaseForm):
>     def processStuff(self):
>         self.clearSessionStore()
>         self.redirect('http://another.url')
> 
> ====================
> (3) Library
> 
> class BaseForm(object):
>     def __init__(self, transaction):
>         self.session = transaction.session()
> 
>     def clearSessionStore(self):
>         list = self.session.values().copy()
>         for item in list.keys():
>             self.session.delValue(item)
> 
>     def redirect(self, url):
>         self.response.sendRedirect(url)
> 
> 
> 
> 
> -------------------------------------------------------
> Sponsored by:
> ThinkGeek at http://www.ThinkGeek.com/
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
> 


-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to