Skip to content
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

Fix for partial signals in old Django and old Python versions. #1641

Merged
merged 10 commits into from
Sep 28, 2022

Conversation

antonpirker
Copy link
Member

Making sure signal name can also be set when partials are used as signal in old Django versions in old Python versions.

Fixes #1640

@@ -21,9 +21,14 @@ def patch_signals():

def _get_receiver_name(receiver):
# type: (Callable[..., Any]) -> str
name = receiver.__module__ + "."
if hasattr(receiver, "__module__"):
Copy link
Member

Choose a reason for hiding this comment

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

can't we just use __qualname__ here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea.

But I checked, the partials also do not have a __qualname__, so: no.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, but we can use __qualname__ if there is one, and if not we use __name__

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

also please add a test using a partial :)

@antonpirker antonpirker merged commit 77b583a into master Sep 28, 2022
@antonpirker antonpirker deleted the antonpirker/1640-partial-signals branch September 28, 2022 12:27
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.

Django Signals integration breaks on partial objects for python <3.10
2 participants