feat: add support for xblock 2

This commit is contained in:
Irtaza Akram
2024-04-01 16:02:06 +05:00
parent 104969c659
commit 3faa773bb9
26 changed files with 80 additions and 86 deletions

View File

@@ -205,7 +205,7 @@ class LearningCoreXBlockRuntime(XBlockRuntime):
# plus some minor additional lines of code as needed.
block = block_class.parse_xml_new_runtime(xml_node, runtime=self, keys=keys)
else:
block = block_class.parse_xml(xml_node, runtime=self, keys=keys, id_generator=None)
block = block_class.parse_xml(xml_node, runtime=self, keys=keys)
# Update field data with parsed values. We can't call .save() because it will call save_block(), below.
block.force_save_fields(block._get_fields_to_save()) # pylint: disable=protected-access

View File

@@ -217,11 +217,11 @@ class XBlockRuntime(RuntimeShim, Runtime):
""" Disable XBlock asides in this runtime """
return []
def parse_xml_file(self, fileobj, id_generator=None):
def parse_xml_file(self, fileobj):
# Deny access to the inherited method
raise NotImplementedError("XML Serialization is only supported with BlockstoreXBlockRuntime")
def add_node_as_child(self, block, node, id_generator=None):
def add_node_as_child(self, block, node):
"""
Called by XBlock.parse_xml to treat a child node as a child block.
"""