def update_enrollment(user_id, course_id, mode=None, is_active=None, enrollment_attributes=None, include_expired=False):
 log.info(u'Starting Update Enrollment process for user {user} in course {course} to mode {mode}'.format(user=user_id, course=course_id, mode=mode))
 if (mode is not None):
  validate_course_mode(course_id, mode, is_active=is_active, include_expired=include_expired)
 enrollment = _data_api().update_course_enrollment(user_id, course_id, mode=mode, is_active=is_active)
 if (enrollment is None):
  msg = u'Course Enrollment not found for user {user} in course {course}'.format(user=user_id, course=course_id)
  log.warn(msg)
  raise errors.EnrollmentNotFoundError(msg)
 elif (enrollment_attributes is not None):
  set_enrollment_attributes(user_id, course_id, enrollment_attributes)
 log.info(u'Course Enrollment updated for user {user} in course {course} to mode {mode}'.format(user=user_id, course=course_id, mode=mode))
 return enrollment

def update_enrollment ( user_id , course_id , mode = None , is_active = None , enrollment_attributes = None , include_expired = False ) : log . info ( u'Starting Update Enrollment process for user {user} in course {course} to mode {mode}' . format ( user = user_id , course = course_id , mode = mode ) ) if ( mode is not None ) : validate_course_mode ( course_id , mode , is_active = is_active , include_expired = include_expired ) enrollment = _data_api ( ) . update_course_enrollment ( user_id , course_id , mode = mode , is_active = is_active ) if ( enrollment is None ) : msg = u'Course Enrollment not found for user {user} in course {course}' . format ( user = user_id , course = course_id ) log . warn ( msg ) raise errors . EnrollmentNotFoundError ( msg ) elif ( enrollment_attributes is not None ) : set_enrollment_attributes ( user_id , course_id , enrollment_attributes ) log . info ( u'Course Enrollment updated for user {user} in course {course} to mode {mode}' . format ( user = user_id , course = course_id , mode = mode ) ) return enrollment
updates the course mode for the enrolled user .