Skip to content

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

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