[mod_python] Servlets, cookies and redirect

Jim Dabell jim-mod-python at jimdabell.com
Thu Aug 26 21:12:53 EDT 2004


> In other words, is there any other way than access req object and set
> cookie through instead of using servlets' add_cookie() method?

According to the servlets documentation, add_cookie() is merely a wrapper for 
Cookie.add_cookie(), which sets the cookie in the normal headers, and upon 
looking at the servlets source, it appears that external_redirect() doesn't 
use the workaround.

You could patch mod_python to fix things so Cookie.add_cookie() sets cookies 
for all types of request.  This may interact badly with (IMHO) buggy software 
that assumes Cookie.add_cookie() is a no-op for "error" pages.

A better idea would be to patch the servlets to make external_redirect() use 
the workaround I mentioned before.  I attached a patch for this before, but it 
appears this mailing list doesn't allow attachments, so let me know if you 
need this and I'll send it to you off-list.

The best idea, in my opinion, is to fix mod_python to honour the headers 
handlers ask it to send, but that too will be incompatible with some (IMHO) 
buggy software.

-- 
Jim Dabell


More information about the Mod_python mailing list