Server side cookie problems

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Feb 6 14:00:22 EST 2008


En Wed, 06 Feb 2008 15:27:53 -0200, rodmc <userprogoogle-139 at yahoo.co.uk>  
escribi�:

> Hi, I am trying to set a cookie on a client computer using the Cookie
> module however all I get is the text being printed in the browser
> window. Can anyone point me in the right direction so that the cookie
>
> def writetocookie(number):
>     #writes the ID of the database entry to a cookie
>     cookie["dataid"]=number
>     print "Content-Type: text/html"
>     print
>     print "Set-Cookie: dataid=",cookie["dataid"].value
>
>
> I presume this is not the correct way to write a cookie, the examples
> I have found online don't seem to provide much more information.

I don't know either if this is the right way, but surely the Set-Cookie  
header must appear *before* the blank line; that blank line separates the  
headers from the response body.

-- 
Gabriel Genellina




More information about the Python-list mailing list