Skip to content
Snippets Groups Projects
Unverified Commit 3deb7f28 authored by David Ormsbee's avatar David Ormsbee Committed by GitHub
Browse files

Merge pull request #18964 from open-craft/opencraft/taranjeet/handle-ccx-display-name-exception

Handle exception while saving course display name.
parents 27cf027a b06b2136
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
from __future__ import unicode_literals
from django.db import migrations
from django.http import Http404
import json
import logging
......@@ -28,7 +29,15 @@ def save_display_name(apps, schema_editor):
# Create `display_name` overrides for these CCX courses
for ccx in ccx_list:
course = get_course_by_id(ccx.course_id, depth=None)
try:
course = get_course_by_id(ccx.course_id, depth=None)
except Http404:
log.error(
"Root course %s not found. Can't create display_name override for %s.",
ccx.course_id,
ccx.display_name
)
continue
display_name = course.fields['display_name']
display_name_json = display_name.to_json(ccx.display_name)
serialized_display_name = json.dumps(display_name_json)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment