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

Signals usage incompatible with Django 4 #58

Open
rmartin48 opened this issue Mar 8, 2023 · 0 comments
Open

Signals usage incompatible with Django 4 #58

rmartin48 opened this issue Mar 8, 2023 · 0 comments

Comments

@rmartin48
Copy link

Summary

Attempting to use drf_model_pusher with Django 4 raises the following exception on startup:

File "/app/.venv/lib/python3.9/site-packages/drf_model_pusher/signals.py", line 4, in <module>
    view_post_save = Signal(
TypeError: __init__() got an unexpected keyword argument 'providing_args'

Django 3.1 deprecated the providing_args kwarg from Signal:

The purely documentational providing_args argument for Signal is deprecated. If you rely on this argument as documentation, you can move the text to a code comment or docstring.

Django 4 has now completely removed this kwarg and raises a TypeError if it is provided.

Proposed Solution

Considering providing_args was only for documentation purposes, we can simply refactor signals.py from:

from django.dispatch import Signal


view_post_save = Signal(
    providing_args=["instance", "channels", "event_name", "data", "socket_id"]
)

view_pre_destroy = Signal(
    providing_args=["instance", "channels", "event_name", "data", "socket_id"]
)

to

from django.dispatch import Signal


view_post_save = Signal()

view_pre_destroy = Signal()
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

No branches or pull requests

1 participant