# HG changeset patch # User Sylvain Thénault # Date 1326974222 -3600 # Node ID eff4fe02ec6478e2526ba5a7f1104f5758cdfdb6 # Parent a4e667270dd43377e04283e4272e0e8aca50e97e [req cookie] fix remove_cookie expires which was leading to expires computed to 0 in set_cookie and the Cookie class interpret that has no expires. Closes #2154654 diff -r a4e667270dd4 -r eff4fe02ec64 web/httpcache.py --- a/web/httpcache.py Fri Dec 09 12:08:27 2011 +0100 +++ b/web/httpcache.py Thu Jan 19 12:57:02 2012 +0100 @@ -23,6 +23,7 @@ from datetime import datetime # time delta usable to convert localized time to GMT time +# XXX this become erroneous after a DST transition!!! GMTOFFSET = - (datetime.now() - datetime.utcnow()) class NoHTTPCacheManager(object): diff -r a4e667270dd4 -r eff4fe02ec64 web/request.py --- a/web/request.py Fri Dec 09 12:08:27 2011 +0100 +++ b/web/request.py Thu Jan 19 12:57:02 2012 +0100 @@ -543,6 +543,10 @@ assert expires is None, 'both max age and expires cant be specified' expires = maxage + time.time() elif expires: + # we don't want to handle times before the EPOCH (cause bug on + # windows). Also use > and not >= else expires == 0 and Cookie think + # that means no expire... + assert expires + GMTOFFSET > date(1970, 1, 1) expires = timegm((expires + GMTOFFSET).timetuple()) else: expires = None @@ -557,11 +561,7 @@ warn('[3.13] remove_cookie now take only a name as argument', DeprecationWarning, stacklevel=2) name = bwcompat - self.set_cookie(name, '', maxage=0, - # substracting GMTOFFSET because set_cookie - # expects a localtime and we don't want to - # handle times before the EPOCH - expires=date(1970, 1, 1) - GMTOFFSET) + self.set_cookie(name, '', maxage=0, expires=date(2000, 1, 1)) def set_content_type(self, content_type, filename=None, encoding=None): """set output content type for this request. An optional filename