-
Notifications
You must be signed in to change notification settings - Fork 515
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
Conversation
@@ -21,9 +21,14 @@ def patch_signals(): | |||
|
|||
def _get_receiver_name(receiver): | |||
# type: (Callable[..., Any]) -> str | |||
name = receiver.__module__ + "." | |||
if hasattr(receiver, "__module__"): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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__
There was a problem hiding this 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 :)
Making sure signal name can also be set when partials are used as signal in old Django versions in old Python versions.
Fixes #1640