Newbie still struggeling with Cookies

Alex Martelli aleaxit at yahoo.com
Tue Nov 21 03:50:00 EST 2000


"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