Server side cookie problems

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


On Feb 7, 1:06 pm, rodmc <userprogoogle-... at yahoo.co.uk> wrote:
> 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

Also how do I find out if a cookie has expired? I have tried various
methods but to no avail?

Cheers,

rod



More information about the Python-list mailing list