#!/Library/Frameworks/Python.framework/Versions/Current/bin/python import cgi, Cookie, os def AskName(c): """ Form to enter user name, using cookie c to show user name. """ print """
""" def GetCookie(): """ Retrieves cookie, and initializes it. """ if os.environ.has_key('HTTP_COOKIE'): c = Cookie.Cookie(os.environ['HTTP_COOKIE']) else: c = Cookie.Cookie() if not c.has_key('login'): c['login'] = '' c['passw'] = '' return c def main(): """ Form to process login. """ c = GetCookie() print c print "Content-type: text/html\n" print "\n" AskName(c) print "\n" main()