-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request.set_cookie(expires) requires a UTC datetime but doesn't document this #254
Comments
Things that need to get fixed for now:
WebOb 1.9:
|
This will convert the TZ aware datetime to one that is not timezone aware and to UTC. This can then be used in math to generate the timedelta for max_age. Also documents that using a local datetime object is not supported, unfortunately there is no good way to find out whether a datetime is local or not, so there is no way to warn the user about bad input. Closes #254
There is no way to determine if a datetime is a local one or not. It's documented as long accepting a UTC datetime. At this point, timezone aware datetime's are converted to UTC, and those work correctly now. |
This will convert the TZ aware datetime to one that is not timezone aware and to UTC. This can then be used in math to generate the timedelta for max_age. Also documents that using a local datetime object is not supported, unfortunately there is no good way to find out whether a datetime is local or not, so there is no way to warn the user about bad input. Closes #254
This will convert the TZ aware datetime to one that is not timezone aware and to UTC. This can then be used in math to generate the timedelta for max_age. Also documents that using a local datetime object is not supported, unfortunately there is no good way to find out whether a datetime is local or not, so there is no way to warn the user about bad input. Closes #254
Currently
Response.set_cookie
will accept adatetime
instance to specify the time at which the cookie should expire.However, this
datetime
instance is expected to be autc
datetime, for exampledatetime.utcnow() + timedelta(seconds=3600)
, not a local datetime likedatetime.now() + timedelta(seconds=3600)
.Also, the provided
datetime
instance must NOT be timezone-aware or you will get an error. For example passingdatetime.utcnow(tz=pytz.utc) + timedelta(seconds=3600)
.If callers are not aware of these requirements, their application might fail unexpectedly if the app moves between time zones.
The text was updated successfully, but these errors were encountered: