[mod_python] Session Tracking

Mike Looijmans mike.looijmans at asml.com
Fri Apr 4 08:40:24 EST 2003


I use the following trick to use the standard Cookie class in mod_python:

##
req.headers_out.add('Set-Cookie', cookies.output(header='',
sep='\r\nSet-Cookie:'))
##

By omitting the first header, and setting the "separator" to "Set-Cookie:' it
actually may add more than just one header here, but who cares...

Actually, I feel that Cookie should provide some method of access to the
individual cookie strings. And a Request.add_cookies(...) method would be even
better (mod_python 3.0.5?):

##
cookies = Cookie.SmartCookie()
...
req.add_cookies(cookies)
##


--
Mike Looijmans
Private: http://www.milosoftware.com

-----Original Message-----
...
>When doing this, I was wondering whether some cookie methods could be
>added to the request object,
>since that's where they seem to belong? Could pass in the class of
>cookie you want to use etc...
>Any thoughts?
...




More information about the Mod_python mailing list