From 499f09e2fb9e6709b1c2b30ab2984cd5d188ddd4 Mon Sep 17 00:00:00 2001 From: Agrendalath Date: Wed, 16 Mar 2022 03:07:46 +0100 Subject: [PATCH] refactor: convert `from_xml` to `parse_xml` for `TranslateCustomTagBlock` --- xmodule/template_module.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/xmodule/template_module.py b/xmodule/template_module.py index 86aadcf169..86dbe883f3 100644 --- a/xmodule/template_module.py +++ b/xmodule/template_module.py @@ -147,19 +147,18 @@ class TranslateCustomTagBlock( # pylint: disable=abstract-method resources_dir = None @classmethod - def from_xml(cls, xml_data, system, id_generator): + def parse_xml(cls, node, runtime, _keys, _id_generator): """ Transforms the xml_data from <$custom_tag attr="" attr=""/> to """ - xml_object = etree.fromstring(xml_data) - system.error_tracker(Text('WARNING: the <{tag}> tag is deprecated. ' - 'Instead, use . ') - .format(tag=xml_object.tag)) + runtime.error_tracker(Text('WARNING: the <{tag}> tag is deprecated. ' + 'Instead, use . ') + .format(tag=node.tag)) - tag = xml_object.tag - xml_object.tag = 'customtag' - xml_object.attrib['impl'] = tag + tag = node.tag + node.tag = 'customtag' + node.attrib['impl'] = tag - return system.process_xml(etree.tostring(xml_object)) + return runtime.process_xml(etree.tostring(node))