fix: review changes
This commit is contained in:
@@ -319,6 +319,11 @@ def _import_xml_node_to_parent(
|
||||
parent_key = parent_xblock.scope_ids.usage_id
|
||||
block_type = node.tag
|
||||
|
||||
# Modulestore's IdGenerator here is SplitMongoIdManager which is assigned
|
||||
# by CachingDescriptorSystem Runtime and since we need our custom ImportIdGenerator
|
||||
# here we are temporaraliy swtiching it.
|
||||
original_id_generator = runtime.id_generator
|
||||
|
||||
# Generate the new ID:
|
||||
runtime.id_generator = ImportIdGenerator(parent_key.context_key)
|
||||
def_id = runtime.id_generator.create_definition(block_type, slug_hint)
|
||||
@@ -360,6 +365,10 @@ def _import_xml_node_to_parent(
|
||||
node_without_children = etree.Element(node.tag, **node.attrib)
|
||||
temp_xblock = xblock_class.parse_xml(node_without_children, runtime, keys)
|
||||
child_nodes = list(node)
|
||||
|
||||
# Restore the original id_generator
|
||||
runtime.id_generator = original_id_generator
|
||||
|
||||
if xblock_class.has_children and temp_xblock.children:
|
||||
raise NotImplementedError("We don't yet support pasting XBlocks with children")
|
||||
temp_xblock.parent = parent_key
|
||||
|
||||
Reference in New Issue
Block a user