diff --git a/openedx/core/djangoapps/xblock/runtime/shims.py b/openedx/core/djangoapps/xblock/runtime/shims.py index f72d584701..ba0e910838 100644 --- a/openedx/core/djangoapps/xblock/runtime/shims.py +++ b/openedx/core/djangoapps/xblock/runtime/shims.py @@ -403,7 +403,7 @@ class XBlockShim: warnings.warn("get_display_blocks() is deprecated.", DeprecationWarning, stacklevel=2) blocks = [] for child in self.get_children(): - blocks.extend(child.displayable_blocks()) + blocks.append(child) return blocks def displayable_items(self): diff --git a/xmodule/library_content_block.py b/xmodule/library_content_block.py index 38dd3a4067..ee8dbfeb76 100644 --- a/xmodule/library_content_block.py +++ b/xmodule/library_content_block.py @@ -399,13 +399,13 @@ class LibraryContentBlock( # 500-response. logger.error('Skipping display for child block that is None') continue - for displayable in child.displayable_blocks(): - rendered_child = displayable.render(STUDENT_VIEW, child_context) - fragment.add_fragment_resources(rendered_child) - contents.append({ - 'id': str(displayable.location), - 'content': rendered_child.content, - }) + + rendered_child = child.render(STUDENT_VIEW, child_context) + fragment.add_fragment_resources(rendered_child) + contents.append({ + 'id': str(child.location), + 'content': rendered_child.content, + }) fragment.add_content(self.runtime.service(self, 'mako').render_template('vert_module.html', { 'items': contents, diff --git a/xmodule/tests/test_conditional.py b/xmodule/tests/test_conditional.py index 928444ee0c..8f63150a92 100644 --- a/xmodule/tests/test_conditional.py +++ b/xmodule/tests/test_conditional.py @@ -91,7 +91,6 @@ class ConditionalFactory: child_descriptor.visible_to_staff_only = False child_descriptor._xmodule.student_view.return_value = Fragment(content='
This is a secret
') # lint-amnesty, pylint: disable=protected-access child_descriptor.student_view = child_descriptor._xmodule.student_view # lint-amnesty, pylint: disable=protected-access - child_descriptor.displayable_blocks.return_value = [child_descriptor] child_descriptor.runtime = descriptor_system child_descriptor.xmodule_runtime = get_test_system() child_descriptor.render = lambda view, context=None: descriptor_system.render(child_descriptor, view, context) diff --git a/xmodule/x_module.py b/xmodule/x_module.py index 23cd362e38..ee120628b9 100644 --- a/xmodule/x_module.py +++ b/xmodule/x_module.py @@ -531,17 +531,10 @@ class XModuleMixin(XModuleFields, XBlock): """ blocks = [] for child in self.get_children(): - blocks.extend(child.displayable_blocks()) + blocks.append(child) return blocks - def displayable_blocks(self): - """ - Returns list of displayable modules contained by this module. If this - module is visible, should return [self]. - """ - return [self] - def get_child_by(self, selector): """ Return a child XBlock that matches the specified selector