From e66fe2b3111c44b8efd7d2da8c5f6d76a15eb3ee Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Wed, 17 Dec 2014 10:59:03 -0500 Subject: [PATCH] MIT: CCX. Properly handle possible representations of the course key --- lms/djangoapps/courseware/grades.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py index 199cb7da05..5256456c87 100644 --- a/lms/djangoapps/courseware/grades.py +++ b/lms/djangoapps/courseware/grades.py @@ -24,6 +24,8 @@ from .models import StudentModule from .module_render import get_module_for_descriptor from submissions import api as sub_api # installed from the edx-submissions repository from opaque_keys import InvalidKeyError +from opaque_keys.edx.keys import CourseKey + log = logging.getLogger("edx.courseware") @@ -501,7 +503,7 @@ def iterate_grades_for(course_or_id, students): make up the final grade. (For display) - raw_scores: contains scores for every graded module """ - if isinstance(course_or_id, basestring): + if isinstance(course_or_id, (basestring, CourseKey)): course = courses.get_course_by_id(course_or_id) else: course = course_or_id