--- a/web/httpcache.py Wed Dec 21 18:14:01 2011 +0100
+++ b/web/httpcache.py Mon Jan 23 12:36:33 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):
--- a/web/request.py Wed Dec 21 18:14:01 2011 +0100
+++ b/web/request.py Mon Jan 23 12:36:33 2012 +0100
@@ -540,6 +540,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
@@ -554,11 +558,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