From 8d1989cf932376d66a769e901ea65848caf21afb Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Tue, 3 Aug 2021 16:16:01 -0400 Subject: [PATCH] fix: allow importing courses into Studio with empty libraries If a content library xblock does not specify a library id, we previously would error out when importing, due to some cleanup code that wasn't accounting for this case. --- common/lib/xmodule/xmodule/modulestore/xml_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index 4134676e61..6e7e612f52 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -878,7 +878,7 @@ def _update_and_import_module( if block.location.block_type == 'library_content': # If library exists, update source_library_version and children # according to this existing library and library content block. - if store.get_library(block.source_library_key): + if block.source_library_id and store.get_library(block.source_library_key): # If the library content block is already in the course, then don't # refresh the children when we re-import it. This lets us address # TNL-7507 (Randomized Content Block Settings Lost in Course Import)