[Tutor] i just cant do it
Alan Gauld
alan.gauld at freenet.co.uk
Mon Sep 18 00:44:06 CEST 2006
> When i try this it works
>
> #!/usr/bin/python
>
> import Cookie
> C = Cookie.SimpleCookie()
> C['adminuser'] = 'fedekiller'
> C['adminuser']['max-age'] = 60*60*24*7
> print C
> print "Content-Type: text/html\n\n"
> print "Bienvenido",C['adminuser'].value,'!'
>
>
> but when i try this it doesnt
Can you explain why you think it should work?
What do yopu think it is doing?
The code below is very obviously completely different to
the code above, so what makes you think it should work?
> #!/usr/bin/python
>
> import Cookie
> print "Content-Type: text/html\n\n"
> print "Bienvenido",C['adminuser'].value,'!'
What is C? Where is it defined?
> i know the cookie exists because firefox display it where
> all the cookies of that domains are.
Cookies exist as small files on your PC. A Python program
needs to be given a clue as to which cookie you are interested
in so that it can access that file. That's what the Cookie module
helps you to do, but it needs to be more than simply imported.
That just makes the tools available, it doesn't actually turn
them on.
HTH,
Alan G.
More information about the Tutor
mailing list