MIT: CCX. Properly handle possible representations of the course key

This commit is contained in:
Chris Rossi
2014-12-17 10:59:03 -05:00
committed by cewing
parent aa1333c363
commit e66fe2b311

View File

@@ -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