From 8141967d1f4cb54494135bd21bb313141115732f Mon Sep 17 00:00:00 2001 From: Agrendalath Date: Tue, 25 Apr 2023 18:28:13 +0200 Subject: [PATCH] refactor: support `get_child_blocks` along with `get_child_descriptors` This method will be renamed in the Redwood release. --- CHANGELOG.rst | 3 +++ completion/__init__.py | 2 +- completion/services.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3322ecd4..f9166451 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,6 +14,9 @@ Change Log Unreleased ~~~~~~~~~~ +[4.2.1]- 2023-04-26 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Support ``get_child_blocks`` along with ``get_child_descriptors``. * Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is deprecated diff --git a/completion/__init__.py b/completion/__init__.py index d0efb252..00d812e0 100644 --- a/completion/__init__.py +++ b/completion/__init__.py @@ -2,6 +2,6 @@ Completion App """ -__version__ = '4.2.0' +__version__ = '4.2.1' default_app_config = 'completion.apps.CompletionAppConfig' # pylint: disable=invalid-name diff --git a/completion/services.py b/completion/services.py index 13e051ae..14174e28 100644 --- a/completion/services.py +++ b/completion/services.py @@ -93,7 +93,9 @@ def get_completable_children(self, node): user_children = [] mode = XBlockCompletionMode.get_mode(node) if mode == XBlockCompletionMode.AGGREGATOR: + # TODO: `get_child_descriptors` will be renamed to `get_child_blocks` in the Redwood release. node_children = ((hasattr(node, 'get_child_descriptors') and node.get_child_descriptors()) + or (hasattr(node, 'get_child_blocks') and node.get_child_blocks()) or (hasattr(node, 'get_children') and node.get_children())) for child in node_children: user_children.extend(self.get_completable_children(child))