[Django] #33549: Cannot use functools.partial when connecting to a signal handler when DEBUG=False

4 views
Skip to first unread message

Django

unread,
Mar 5, 2022, 6:22:14 AM3/5/22
to django-...@googlegroups.com
#33549: Cannot use functools.partial when connecting to a signal handler when
DEBUG=False
-----------------------------------------+------------------------
Reporter: Salaah Amin | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Come across an issue where a signal is not handled when using
`functools.partails` to connect to a function when `DEBUG=False`.

We have the following code:
{{{#!python
from functools import partial
from django import dispatch


signal_name = django_dispatch.Signal()
signal_name.connect(
partial(signal_handler, some_attr=False),
sender=model
)
}}}

When debug is `True` and the signal is fired, then the function
`signal_handler` is executed.
However, when debug is `False`, the code is not executed.

I added a print statement at the start of the function, and the function
does not read `settings.DEBUG`.

--
Ticket URL: <https://code.djangoproject.com/ticket/33549>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 5, 2022, 6:22:15 AM3/5/22
to django-...@googlegroups.com
#33549: Cannot use functools.partial when connecting to a signal handler when
DEBUG=False
------------------------------+--------------------------------------

Reporter: Salaah Amin | Owner: nobody
Type: Bug | Status: closed
Component: Core (Other) | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => needsinfo
* component: Uncategorized => Core (Other)


Comment:

Hi, I don't think you've explained the issue in enough detail to confirm a
bug in Django. Please reopen the ticket if you can debug your issue and
provide details about why and where Django is at fault. If you're having
trouble understanding how Django works, see
TicketClosingReasons/UseSupportChannels for ways to get help.

--
Ticket URL: <https://code.djangoproject.com/ticket/33549#comment:1>

Reply all
Reply to author
Forward
0 new messages