From 4de58d8dacce1b41e8fae0dad09adcfaeb147b11 Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Fri, 15 Dec 2023 10:00:09 -0800 Subject: [PATCH] fix: type-safe check for block type --- cms/djangoapps/contentstore/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/helpers.py b/cms/djangoapps/contentstore/helpers.py index 3ca67b0cb031..9fd09193b59f 100644 --- a/cms/djangoapps/contentstore/helpers.py +++ b/cms/djangoapps/contentstore/helpers.py @@ -17,6 +17,7 @@ from xmodule.contentstore.content import StaticContent from xmodule.contentstore.django import contentstore from xmodule.exceptions import NotFoundError +from xmodule.library_content_block import LibraryContentBlock from xmodule.modulestore.django import modulestore from xmodule.xml_block import XmlMixin @@ -336,7 +337,7 @@ def _import_xml_node_to_parent( new_xblock = store.update_item(temp_xblock, user_id, allow_not_found=True) parent_xblock.children.append(new_xblock.location) store.update_item(parent_xblock, user_id) - if new_xblock.scope_ids.block_type == "library_content": + if isinstance(new_xblock, LibraryContentBlock): # Special case handling for library content. If we need this for other blocks in the future, it can be made into # an API, and we'd call new_block.studio_post_paste() instead of this code. # In this case, we want to pull the children from the library and let library_tools assign their IDs.