Newbie still struggeling with Cookies

David Lees DavidL.no.no.spam.no at raqia.com
Tue Nov 21 15:28:15 EST 2000


Thanks SZhao and Alex.  I still have some reading to understand the
comments below, but I can now set cookies from this test script.  Much
appreciated.

david lees


Alex Martelli wrote:
> 
> "David Lees" <DavidL.no.no.spamno at raqia.com> wrote in message
> news:3A198B1A.89C8E902 at raqia.com...
> > It works.  Great.  Thank you very much.
> >
> > I am a bit puzzled how it works.  I did not change the line:
> > CGI_HANDLER = "/cgi-bin/test.py"
> >
> > and I have nothing called "test.py" in my cgi-bin directory.  I called
> > the code below "TestCookie.py" and executed directly from my Netscape
>     [snip]
> > >     path = os.environ.get('SCRIPT_NAME', CGI_HANDLER)
> > >     print "Set-Cookie: %s=%s; path=%s;" % (name, value, path),
> 
> The value bound to CGI_HANDLER is used only as a default-value for
> the get method of os.environ to return -- so that, if key SCRIPT_NAME
> is not in the environment, you still have some value bound to path.
> The only use of this is printing as part of the Set-Cookie line...
> 
> Alex



More information about the Python-list mailing list