[mod_python] servlets and cookies

Byron Ellacott bje at apnic.net
Mon Nov 1 23:01:26 EST 2004


John Aherne wrote:
>      check = Cookie.Cookie('user','niven')
>      Cookie.add_cookie(self.req, check)
>      self.external_redirect('cookmps')
>  I hope someone can give me a clue as to what the problem is.

I believe that this is due to the way Apache only uses the headers_out 
structure for OK return values.  For all other return values, including 
redirects, it will use the headers_err_out (or similarly named?) 
structure instead.

Cookie.add_cookie() will be modifying headers_out, not headers_err_out. 
  Let me verify what I'm saying...

Uh, err_headers_out.

So, you could use:

     req.err_headers_out.add('Set-Cookie', check)

-- 
bje


More information about the Mod_python mailing list