#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107017f59d0cfc7-6f2f4fad-5ab5-4aa3-a7de-d9105b298bd7-000000%40eu-central-1.amazonses.com.

Reply via email to