Print recent CGI error
Gnarlodious
gnarlodious at gmail.com
Sat Dec 4 19:00:25 EST 2010
After many curse words I figured it out. A two-stage filter was
needed. The 5th line solves the problem of colliding domain cookies:
NowCookie=http.cookies.SimpleCookie() # Instantiate a SimpleCookie
object
savedCookie=os.environ.get('HTTP_COOKIE') # get the cookie string
if savedCookie: # Already is a domain cookie
NowCookie.load(savedCookie) # Could be any domain cookie
if CookieName in NowCookie: # Look for a specific cookie
savedCookie=NowCookie[CookieName].value # Load the cookie
string into a dict
self.List=list(savedCookie.split('~')) # Parse the payload
string delimited at tilde
return
self.List=[hashlib.sha1(repr(time.time()).encode()).hexdigest(), '',
''] # Else default payload
self.Write() # Tell the client to remember
-- Gnarlie
More information about the Python-list
mailing list