From 6f5c49e7b64e198bb33e78981b7e035c076e4bde Mon Sep 17 00:00:00 2001 From: Sanford Student Date: Wed, 7 Mar 2018 15:30:01 -0500 Subject: [PATCH] guard against missing setting --- openedx/core/djangoapps/user_api/accounts/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/user_api/accounts/utils.py b/openedx/core/djangoapps/user_api/accounts/utils.py index d1387934c7..50eef5e248 100644 --- a/openedx/core/djangoapps/user_api/accounts/utils.py +++ b/openedx/core/djangoapps/user_api/accounts/utils.py @@ -14,6 +14,7 @@ from completion.models import BlockCompletion from openedx.core.djangoapps.site_configuration.models import SiteConfiguration from openedx.core.djangoapps.theming.helpers import get_config_value_from_site_or_settings, get_current_site from xmodule.modulestore.django import modulestore +from xmodule.modulestore.exceptions import ItemNotFoundError def validate_social_link(platform_name, new_social_link): @@ -161,9 +162,13 @@ def retrieve_last_sitewide_block_completed(username): return lms_root = SiteConfiguration.get_value_for_org(candidate_course.org, "LMS_ROOT_URL", settings.LMS_ROOT_URL) - item = modulestore().get_item(candidate_block_key, depth=1) - if not lms_root: + try: + item = modulestore().get_item(candidate_block_key, depth=1) + except ItemNotFoundError: + item = None + + if not (lms_root and item): return return u"{lms_root}/courses/{course_key}/jump_to/{location}".format(