I’m adding to an existing repo containing two Django plugin apps, both of which include properly-working Django signal receivers, as follows:
from django.core.signals import request_finished
from openedx.core.djangoapps.signals.signals import COURSE_GRADE_NOW_PASSED
@receiver(COURSE_GRADE_NOW_PASSED, dispatch_uid="i_am_unique")
def this_sparks_joy(sender, user, course_id, **kwargs):
print("Marie Kondo cleaned the entry closet")
@receiver(request_finished)
def this_also_sparks_joy(sender, **kwargs):
print("Marie Kondo cleaned the pantry")
Oddly however, the following new Django signal that I’m trying to add does not work:
from common.lib.xmodule.xmodule.modulestore.django import SignalHandler
@receiver(SignalHandler.course_published, dispatch_uid="i_am_also_unique")
def this_does_not_spark_joy(sender, course_key, **kwargs):
print("Marie Kondo does not clean this room for some reason")
I’ve confirmed that the signals themselves all load correctly via apps.py in both apps using the following pattern:
def ready(self):
"""
Connect handlers to signals.
"""
from . import signals
I’ve also done diagnostics to verify that the @receiver decorator of the malfunctioning app at least recognizes the existence of the handler def, this_does_not_spark_joy(). the malfunctioning signal, “course_published” inherits django.dispatch.Signal and this slight modification seems benign in my case, aside from it not firing my handler that is.
Has anyone experienced similar behavior?