Opened 3 years ago

Closed 3 years ago

#33549 closed Bug (needsinfo)

Cannot use functools.partial when connecting to a signal handler when DEBUG=False

Reported by: Salaah Amin Owned by: nobody
Component: Core (Other) Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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:

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.

Change History (1)

comment:1 by Mariusz Felisiak, 3 years ago

Component: UncategorizedCore (Other)
Resolution: needsinfo
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top