Cookies and Python
nnewhard at origin.ea.com
Tue Mar 7 17:32:32 CET 2000
Tim, Thanks for the help!
>> The problem is, the cookie never seems to get saved between browser
>That's because you never send it back to the client browser. You need
>to send the cookie value in the headers. This means you should send
>the cookie value IMMEDIATELY following the "Content-Type:" header.
Got it. So the cookie has to be part of the header stuff, not just any part
of the HTML doc. Makes sense. I am enlightened.
The skeleton almost worked. form["username"] can't be passed as a parameter
to ck.get() if it doesn't exist (raises KeyError), so I added a second
(redundant) check. It would be great if CGI forms supported get() as
well...perhaps in 1.6?
username = ck.get("username", form["username"]).value
More information about the Python-list