Server side cookie problems

rodmc userprogoogle-139 at yahoo.co.uk
Thu Feb 7 07:06:31 EST 2008


On Feb 6, 8:00 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Wed, 06 Feb 2008 15:27:53 -0200, rodmc <userprogoogle-... 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

Thanks, that seemed to work.

rod



More information about the Python-list mailing list