Cookies

Victor Subervi victorsubervi at gmail.com
Tue Dec 29 14:42:20 EST 2009


Hi;
I have these lines:

  cookie = os.environ.get('HTTP_COOKIE')
  if not cookie:
    cookie = Cookie.SimpleCookie()
    cExpires, cPath, cComment, cDomain, cMaxAge, cVersion = myCookie()
    cookie['lastvisit'] = str(time.time())
    cookie['lastvisit']['expires'] = cExpires
    cookie['lastvisit']['path'] = cPath
    cookie['lastvisit']['comment'] = cComment
    cookie['lastvisit']['domain'] = cDomain
    cookie['lastvisit']['max-age'] = cMaxAge
    cookie['lastvisit']['version'] = cVersion
    cookieFlag = 'new'
  else:
    cookie = Cookie.SimpleCookie(cookie)
    cookieFlag = 'old'
  print '''Content-Type: text/html\r\n
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
'''
  print cookieFlag

cookieFlag prints 'new'. Every time. Even when I refresh. I've imported
Cookie. I've followed the tutorials :-} I've already been through my problem
with trying to find the cookies on this computer. The fact that I'm using
gmail is proof that cookies are enabled. I have also tried:
cookie = os.environ.has_key('HTTP_COOKIE')
Please advise.
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091229/6dde8c23/attachment.html>


More information about the Python-list mailing list