diff --git a/xblocks_contrib/annotatable/annotatable.py b/xblocks_contrib/annotatable/annotatable.py index 3e698d1a..e6a44365 100644 --- a/xblocks_contrib/annotatable/annotatable.py +++ b/xblocks_contrib/annotatable/annotatable.py @@ -246,6 +246,28 @@ def workbench_scenarios(): ), ] + @classmethod + def parse_xml_new_runtime(cls, node, runtime, keys): + """ + Interpret the parsed XML in `node`, creating a new instance of this + module. + """ + # In the new/openedx_content-based runtime, XModule parsing (from + # XmlMixin) is disabled, so definition_from_xml will not be + # called, and instead the "normal" XBlock parse_xml will be used. + # However, it's not compatible with RawMixin, so we implement + # support here. + data_field_value = cls.definition_from_xml(node, None)[0]["data"] + for child in node.getchildren(): + node.remove(child) + # Get attributes, if any, via normal parse_xml. + try: + block = super().parse_xml_new_runtime(node, runtime, keys) + except AttributeError: + block = super().parse_xml(node, runtime, keys) + block.data = data_field_value + return block + @classmethod def definition_from_xml(cls, xml_object, system): if len(xml_object) == 0 and len(list(xml_object.items())) == 0: