@receiver(UNENROLL_DONE)
def handle_unenroll_done(sender, course_enrollment=None, skip_refund=False, **kwargs):
 if ((not is_commerce_service_configured()) or skip_refund):
  return
 if (course_enrollment and course_enrollment.refundable()):
  try:
   request_user = (get_request_user() or course_enrollment.user)
   if isinstance(request_user, AnonymousUser):
    return
   refund_seat(course_enrollment, request_user)
  except:
   log.exception(u'Unexpected exception while attempting to initiate refund for user [%s], course [%s]', course_enrollment.user.id, course_enrollment.course_id)

@ receiver ( UNENROLL_DONE ) def handle_unenroll_done ( sender , course_enrollment = None , skip_refund = False , ** kwargs ) : if ( ( not is_commerce_service_configured ( ) ) or skip_refund ) : return if ( course_enrollment and course_enrollment . refundable ( ) ) : try : request_user = ( get_request_user ( ) or course_enrollment . user ) if isinstance ( request_user , AnonymousUser ) : return refund_seat ( course_enrollment , request_user ) except : log . exception ( u'Unexpected exception while attempting to initiate refund for user [%s], course [%s]' , course_enrollment . user . id , course_enrollment . course_id )
signal receiver for unenrollments .