Στις 9/10/2013 9:36 μμ, ο/η Piet van Oostrum έγραψε:
Νίκος Αλεξόπουλος <nikos.gr...@gmail.com> writes:
# initialize cookie and retrieve cookie from clients browser
cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] )
if cookie.get('ID') is not None:
cookieID = cookie['ID'].value
else:
cookieID = random.randrange(0, 9999)
cookie['ID'] = cookieID
cookie['ID']['domain'] = ".superhost.gr"
cookie['ID']['path'] = '/'
cookie["ID"]["expires"] = 60*60*24*365 # this cookie will
expire in a year
As Ian already has told you (but apparently you didn't pay attention to), your
expires is wrong. So if your cookies disappear you should get this right first.
from datetime import datetime, timedelta
expiretime = datetime.utcnow() + timedelta(days=365)
cookie["ID"]["expires"] = expiretime.strftime("%a, %d %b %Y %H:%M:%S GMT")
Expire is not the issue here, as i have it is working with no problem.
when i print the cookie expiration time is calculated properly.
Something else is going worng.
--
https://mail.python.org/mailman/listinfo/python-list