Skip to content

Stop using deprecated datetime.utcnow() - #2759

Open
c-tonneslan wants to merge 1 commit into
DemocracyClub:masterfrom
c-tonneslan:chore/utcnow-deprecation
Open

Stop using deprecated datetime.utcnow()#2759
c-tonneslan wants to merge 1 commit into
DemocracyClub:masterfrom
c-tonneslan:chore/utcnow-deprecation

Conversation

@c-tonneslan

Copy link
Copy Markdown

Python 3.12 deprecated datetime.utcnow(). Two call sites left in the repo: candidates/views/version_data.get_current_timestamp (used for new Person version metadata) and a fixture in people/tests/test_revert.py. Both write a naive UTC isoformat into JSON, so swapped for datetime.now(timezone.utc).replace(tzinfo=None) to keep the same shape.

Python 3.12 deprecates the bare utcnow(). Swap version_data and the
revert test for datetime.now(timezone.utc).replace(tzinfo=None), which
keeps the naive UTC isoformat the rest of the code expects.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant