[mod_python] Chewing cookies

Mateusz Korniak mateusz at ant.gliwice.pl
Mon Jul 22 11:02:42 EST 2002

> 'REQUEST.headers_out.add('Set-Cookie',cookie_value)' seems the recommended
> way to set up multiple cookies on the client.
> But what is the recommended way to get back at those cookies?
> Seems to me that anything like 'REQUEST.headers_in['Set-Cookie'] is no good
> with more than one cookie, for obvious reasons.
> Any tips would be appreciated.

This code works for me: (all cookies seems to be send via single Cookie 
		self.cookies = abbon.html.Cookie.Cookie() # Cookie module downloaded from 
www.python.org as py < 2.0 didn't have Cookie module

		if self.raw_request.headers_in.has_key('Cookie'):

		if self.cookies.has_key(COOKIEUID):
			self.cookie_uid = str(self.cookies[COOKIEUID].value)

		if self.cookies.has_key(SES):
			self.cookie_ses = str(self.cookies[SES].value)

HIH ...
Mateusz Korniak

More information about the Mod_python mailing list