Skip to content

Conversation

@kkirsche
Copy link
Contributor

@kkirsche kkirsche commented Jun 17, 2022

Naïve datetime objects are discouraged in https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Warning Because naive datetime objects are treated by many datetime methods as local times, it is preferred to use aware datetimes to represent times in UTC. As such, the recommended way to create an object representing the current time in UTC is by calling datetime.now(timezone.utc).

  • fixes N/A

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@davidism davidism added this to the 2.2.0 milestone Jun 17, 2022
@kkirsche
Copy link
Contributor Author

Sorry for not including all the contributing items. Some of the entries if you are open to this change I will do once I update my personal access token (can't work with this repo on the CLI right now due to not having the workflow permission authorized from the CLI)

@davidism
Copy link
Member

I updated everything else to be timezone aware, this makes sense too. This case is already treated as UTC in set_cookie, but might as well be consistent.

@kkirsche
Copy link
Contributor Author

  1. Changes entry added
  2. I don't believe that there is a relevant documentation update, but please let me know if that's incorrect
  3. Existing tests related to verifying the session's expiration cover this, I believe

Please let me know if there is anything else you need and I'll do my best to provide those updates

@davidism davidism merged commit 7f2a0f4 into pallets:main Jun 17, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants