You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a timedelta to calculate the absolute timestamp, webob uses datetime.now(), which is in local time. This is later re-interpreted to be UTC, which yields an "Expires" header value that is off by the UTC offset of the local timezone.
Example in CEST:
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime, timedelta
>>> from webob import Response
>>> datetime.utcnow()
datetime.datetime(2021, 4, 23, 13, 48, 1, 541647)
>>> r = Response()
>>> r.expires = timedelta(seconds=0)
>>> r.expires
datetime.datetime(2021, 4, 23, 15, 48, 13, tzinfo=UTC)
The example shows that setting expires to a zero timedelta produces a header value two hours in the future.
The cache_expires method does the right when passed a timedelta.
The text was updated successfully, but these errors were encountered:
When using a timedelta to calculate the absolute timestamp, webob uses
datetime.now()
, which is in local time. This is later re-interpreted to be UTC, which yields an "Expires" header value that is off by the UTC offset of the local timezone.Example in CEST:
The example shows that setting
expires
to a zero timedelta produces a header value two hours in the future.The
cache_expires
method does the right when passed a timedelta.The text was updated successfully, but these errors were encountered: