EDUCATOR-3 Check for course before using it.

This commit is contained in:
attiyaishaque
2017-05-25 15:40:29 +05:00
parent 74f9858b77
commit 7f3e4cb810
3 changed files with 8 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ import logging
from django.conf import settings
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
from contentstore.views.helpers import is_item_in_course_tree
from edx_proctoring.api import (
@@ -40,6 +40,9 @@ def register_special_exams(course_key):
return
course = modulestore().get_course(course_key)
if course is None:
raise ItemNotFoundError("Course {} does not exist", unicode(course_key))
if not course.enable_proctored_exams and not course.enable_timed_exams:
# likewise if course does not have these features turned on
# then quickly exit