Skip to content

Fixed user save-signal issue with Haalcentraal BRP retrieval logging #1062

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

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

Bartvaderkin
Copy link
Contributor

@Bartvaderkin Bartvaderkin commented Feb 29, 2024

This was kind of gnarly:

  1. We can't use pre_save signal because we need a saved user
  2. Calling save() from either a pre_save or post_save handler creates a signal loop

Solution: use post_save so we have a saved user, and break the loop.

Downside is this will trigger any other post_save handler multiple times, which is a vote to centralize signal based user update stuff. Most of it is currently user_logged_in so not an issue.

Note this PR targets the open Django 4.x branch #1024

@Bartvaderkin Bartvaderkin marked this pull request as ready for review February 29, 2024 12:01
@Bartvaderkin Bartvaderkin mentioned this pull request Feb 29, 2024
5 tasks
Copy link
Contributor

@pi-sigma pi-sigma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea with checking/setting the flag in on_bsn_change! Strange how this could pass with Django 3.2 and only fail with the upgrade, but this seems like the right behavior.

@pi-sigma pi-sigma merged commit 6715a92 into upgrade/django-4.2 Feb 29, 2024
@pi-sigma pi-sigma deleted the upgrade/django-4.2-brp-logfix branch February 29, 2024 13:54
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.

2 participants