@receiver(send_user_notification, sender=CourseCreator)
def send_user_notification_callback(sender, **kwargs):
 user = kwargs['user']
 updated_state = kwargs['state']
 studio_request_email = settings.FEATURES.get('STUDIO_REQUEST_EMAIL', '')
 context = {'studio_request_email': studio_request_email}
 subject = render_to_string('emails/course_creator_subject.txt', context)
 subject = ''.join(subject.splitlines())
 if (updated_state == CourseCreator.GRANTED):
  message_template = 'emails/course_creator_granted.txt'
 elif (updated_state == CourseCreator.DENIED):
  message_template = 'emails/course_creator_denied.txt'
 else:
  message_template = 'emails/course_creator_revoked.txt'
 message = render_to_string(message_template, context)
 try:
  user.email_user(subject, message, studio_request_email)
 except:
  log.warning('Unable to send course creator status e-mail to %s', user.email)

@ receiver ( send_user_notification , sender = CourseCreator ) def send_user_notification_callback ( sender , ** kwargs ) : user = kwargs [ 'user' ] updated_state = kwargs [ 'state' ] studio_request_email = settings . FEATURES . get ( 'STUDIO_REQUEST_EMAIL' , '' ) context = { 'studio_request_email' : studio_request_email } subject = render_to_string ( 'emails/course_creator_subject.txt' , context ) subject = '' . join ( subject . splitlines ( ) ) if ( updated_state == CourseCreator . GRANTED ) : message_template = 'emails/course_creator_granted.txt' elif ( updated_state == CourseCreator . DENIED ) : message_template = 'emails/course_creator_denied.txt' else : message_template = 'emails/course_creator_revoked.txt' message = render_to_string ( message_template , context ) try : user . email_user ( subject , message , studio_request_email ) except : log . warning ( 'Unable to send course creator status e-mail to %s' , user . email )
callback for notifying user about course creator status change .