signals.py 745 Bytes
Newer Older
Giovanni Di Milia committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
"""
Signal handler for posting course updated to CCXCon
"""
from django.dispatch.dispatcher import receiver

from xmodule.modulestore.django import SignalHandler


@receiver(SignalHandler.course_published, dispatch_uid='ccxcon_course_publish_handler')
def _listen_for_course_publish(sender, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Listener for course_plublish events.
    This listener takes care of submitting a task to update CCXCon
    """
    # update the course information on ccxcon using celery
    # import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
    from openedx.core.djangoapps.ccxcon import tasks
    tasks.update_ccxcon.delay(unicode(course_key))