'Modifies a CCX course.
Args:
request (Request): Django request object.
ccx_course_id (string): URI element specifying the CCX course location.'

def patch(self, request, ccx_course_id=None):

    (ccx_course_object, ccx_course_key, error_code, http_status) = self.get_object(ccx_course_id, is_ccx=True)
    if (ccx_course_object is None):
        return Response(status=http_status, data={'error_code': error_code})
    master_course_id = request.data.get('master_course_id')
    if ((master_course_id is not None) and (unicode(ccx_course_object.course_id) != master_course_id)):
        return Response(status=status.HTTP_403_FORBIDDEN, data={'error_code': 'master_course_id_change_not_allowed'})
    (valid_input, field_errors) = get_valid_input(request.data, ignore_missing=True)
    if field_errors:
        return Response(status=status.HTTP_400_BAD_REQUEST, data={'field_errors': field_errors})
    (master_course_object, master_course_key, _, _) = get_valid_course(unicode(ccx_course_object.course_id))
    with transaction.atomic():
        if ('display_name' in valid_input):
            ccx_course_object.display_name = valid_input['display_name']
        old_coach = None
        if ('coach_email' in valid_input):
            try:
                coach = User.objects.get(email=valid_input['coach_email'])
            except User.DoesNotExist:
                return Response(status=status.HTTP_404_NOT_FOUND, data={'error_code': 'coach_user_does_not_exist'})
            if (ccx_course_object.coach.id != coach.id):
                old_coach = ccx_course_object.coach
                ccx_course_object.coach = coach
        if ('course_modules' in valid_input):
            if valid_input.get('course_modules'):
                if (not valid_course_modules(valid_input['course_modules'], master_course_key)):
                    return Response(status=status.HTTP_400_BAD_REQUEST, data={'error_code': 'course_module_list_not_belonging_to_master_course'})
            ccx_course_object.structure_json = json.dumps(valid_input.get('course_modules'))
        ccx_course_object.save()
        if ('max_students_allowed' in valid_input):
            override_field_for_ccx(ccx_course_object, ccx_course_object.course, 'max_student_enrollments_allowed', valid_input['max_students_allowed'])
        if (old_coach is not None):
            make_user_coach(coach, master_course_key)
            email_params = get_email_params(master_course_object, auto_enroll=True, course_key=ccx_course_key, display_name=ccx_course_object.display_name)
            enroll_email(course_id=ccx_course_key, student_email=coach.email, auto_enroll=True, email_students=True, email_params=email_params)
            assign_staff_role_to_ccx(ccx_course_key, coach, master_course_object.id)
    responses = SignalHandler.course_published.send(sender=ccx_course_object, course_key=ccx_course_key)
    for (rec, response) in responses:
        log.info('Signal    fired    when    course    is    published.    Receiver:    %s.    Response:    %s', rec, response)
    return Response(status=status.HTTP_204_NO_CONTENT)
