From 5ea74e0282eddf3f9dc931640a3f838e74318f45 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Mon, 19 Aug 2019 15:08:27 -0400 Subject: [PATCH] Ensure that the course_id is unicode. --- lms/djangoapps/course_goals/handlers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/course_goals/handlers.py b/lms/djangoapps/course_goals/handlers.py index ef4afb8c9f..d57321aa4d 100644 --- a/lms/djangoapps/course_goals/handlers.py +++ b/lms/djangoapps/course_goals/handlers.py @@ -21,7 +21,9 @@ def update_course_goal_on_enroll_change(sender, instance, **kwargs): # pylint: 1) Set the course goal to 'certify' when the user enrolls as a verified user. 2) Remove the course goal when the user's enrollment is no longer active. """ - course_id = six.text_type(instance.course_id) + course_id = instance.course_id + if isinstance(course_id, six.binary_type): + course_id = course_id.decode('utf8', 'ignore') if not instance.is_active: remove_course_goal(instance.user, course_id) elif instance.mode == CourseMode.VERIFIED: