Commit ce3bf6bd by Bridger Maxwell

check_course didn't have the right exception being caught.

parent 15bf1174
...@@ -8,6 +8,7 @@ from django.http import Http404 ...@@ -8,6 +8,7 @@ from django.http import Http404
from xmodule.course_module import CourseDescriptor from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -29,7 +30,7 @@ def check_course(course_id, course_must_be_open=True, course_required=True): ...@@ -29,7 +30,7 @@ def check_course(course_id, course_must_be_open=True, course_required=True):
try: try:
course_loc = CourseDescriptor.id_to_location(course_id) course_loc = CourseDescriptor.id_to_location(course_id)
course = modulestore().get_item(course_loc) course = modulestore().get_item(course_loc)
except KeyError: except (KeyError, ItemNotFoundError):
raise Http404("Course not found.") raise Http404("Course not found.")
if course_must_be_open and not course.has_started(): if course_must_be_open and not course.has_started():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment