From ba23375bd4f17dbf98c719d1a26667a33ef78182 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Thu, 30 Oct 2025 17:09:47 +0500 Subject: [PATCH 1/4] fix: replace ImportSystem with XMLImportingModuleStoreRuntime --- src/ol_openedx_chat/ol_openedx_chat/block.py | 4 ++-- src/ol_openedx_chat/tests/test_aside.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ol_openedx_chat/ol_openedx_chat/block.py b/src/ol_openedx_chat/ol_openedx_chat/block.py index 4ccc04fd7..2ea7ab91c 100644 --- a/src/ol_openedx_chat/ol_openedx_chat/block.py +++ b/src/ol_openedx_chat/ol_openedx_chat/block.py @@ -11,7 +11,7 @@ from webob.response import Response from xblock.core import XBlock, XBlockAside from xblock.fields import Boolean, Scope -from xmodule.modulestore.xml import ImportSystem +from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime from xmodule.video_block.transcripts_utils import ( Transcript, get_available_transcript_languages, @@ -211,7 +211,7 @@ def should_apply_to_block(cls, block): # In that case, we cannot check for the course settings and waffle flag. # We only check for the block type. For normal CMS and LMS flows, it will # check for the course settings and waffle flag. - if isinstance(block.runtime, ImportSystem): + if isinstance(block.runtime, XMLImportingModuleStoreRuntime): return is_aside_applicable_to_block(block=block) return ( diff --git a/src/ol_openedx_chat/tests/test_aside.py b/src/ol_openedx_chat/tests/test_aside.py index 66059e66d..d2becaaa2 100644 --- a/src/ol_openedx_chat/tests/test_aside.py +++ b/src/ol_openedx_chat/tests/test_aside.py @@ -18,7 +18,7 @@ from openedx.core.djangolib.testing.utils import skip_unless_cms, skip_unless_lms from xblock.core import XBlockAside from xmodule.modulestore import ModuleStoreEnum -from xmodule.modulestore.xml import ImportSystem +from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime from tests.utils import OLChatTestCase @@ -262,7 +262,7 @@ def test_should_apply_to_block( ) if is_import_runtime: - block.runtime = Mock(spec=ImportSystem) + block.runtime = Mock(spec=XMLImportingModuleStoreRuntime) aside_instance = ( self.problem_aside_instance From bc0b4102f55da63845b13f6b2c738dee0a366d23 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Thu, 30 Oct 2025 17:11:20 +0500 Subject: [PATCH 2/4] update version --- src/ol_openedx_chat/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol_openedx_chat/pyproject.toml b/src/ol_openedx_chat/pyproject.toml index deb90c54b..172b62e88 100644 --- a/src/ol_openedx_chat/pyproject.toml +++ b/src/ol_openedx_chat/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ol-openedx-chat" -version = "0.4.0" +version = "0.5.0" description = "An Open edX plugin to add Open Learning AI chat aside to xBlocks" authors = [ {name = "MIT Office of Digital Learning"} From 008e6b1b33d71edb56d245a854d7a7d3421e5261 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Fri, 31 Oct 2025 12:54:49 +0500 Subject: [PATCH 3/4] add fallback --- src/ol_openedx_chat/ol_openedx_chat/block.py | 5 ++++- src/ol_openedx_chat/tests/test_aside.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ol_openedx_chat/ol_openedx_chat/block.py b/src/ol_openedx_chat/ol_openedx_chat/block.py index 2ea7ab91c..efee96cdf 100644 --- a/src/ol_openedx_chat/ol_openedx_chat/block.py +++ b/src/ol_openedx_chat/ol_openedx_chat/block.py @@ -11,7 +11,10 @@ from webob.response import Response from xblock.core import XBlock, XBlockAside from xblock.fields import Boolean, Scope -from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime +try: + from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime as XMLImportingModuleStoreRuntime +except ImportError: + from xmodule.modulestore.xml import ImportSystem as XMLImportingModuleStoreRuntime from xmodule.video_block.transcripts_utils import ( Transcript, get_available_transcript_languages, diff --git a/src/ol_openedx_chat/tests/test_aside.py b/src/ol_openedx_chat/tests/test_aside.py index d2becaaa2..52f5f5dd5 100644 --- a/src/ol_openedx_chat/tests/test_aside.py +++ b/src/ol_openedx_chat/tests/test_aside.py @@ -18,7 +18,10 @@ from openedx.core.djangolib.testing.utils import skip_unless_cms, skip_unless_lms from xblock.core import XBlockAside from xmodule.modulestore import ModuleStoreEnum -from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime +try: + from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime as XMLImportingModuleStoreRuntime +except ImportError: + from xmodule.modulestore.xml import ImportSystem as XMLImportingModuleStoreRuntime from tests.utils import OLChatTestCase From 0e6cfdae9435b62111cb2e891e80bd98469541b5 Mon Sep 17 00:00:00 2001 From: Asad Ali Date: Fri, 31 Oct 2025 13:08:23 +0500 Subject: [PATCH 4/4] update pre-commit errors --- src/ol_openedx_chat/ol_openedx_chat/block.py | 5 ++++- src/ol_openedx_chat/tests/test_aside.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ol_openedx_chat/ol_openedx_chat/block.py b/src/ol_openedx_chat/ol_openedx_chat/block.py index efee96cdf..16bc24e8d 100644 --- a/src/ol_openedx_chat/ol_openedx_chat/block.py +++ b/src/ol_openedx_chat/ol_openedx_chat/block.py @@ -11,8 +11,11 @@ from webob.response import Response from xblock.core import XBlock, XBlockAside from xblock.fields import Boolean, Scope + try: - from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime as XMLImportingModuleStoreRuntime + from xmodule.modulestore.xml import ( + XMLImportingModuleStoreRuntime as XMLImportingModuleStoreRuntime, # noqa: PLC0414 + ) except ImportError: from xmodule.modulestore.xml import ImportSystem as XMLImportingModuleStoreRuntime from xmodule.video_block.transcripts_utils import ( diff --git a/src/ol_openedx_chat/tests/test_aside.py b/src/ol_openedx_chat/tests/test_aside.py index 52f5f5dd5..7f0eee74b 100644 --- a/src/ol_openedx_chat/tests/test_aside.py +++ b/src/ol_openedx_chat/tests/test_aside.py @@ -18,8 +18,11 @@ from openedx.core.djangolib.testing.utils import skip_unless_cms, skip_unless_lms from xblock.core import XBlockAside from xmodule.modulestore import ModuleStoreEnum + try: - from xmodule.modulestore.xml import XMLImportingModuleStoreRuntime as XMLImportingModuleStoreRuntime + from xmodule.modulestore.xml import ( + XMLImportingModuleStoreRuntime as XMLImportingModuleStoreRuntime, # noqa: PLC0414 + ) except ImportError: from xmodule.modulestore.xml import ImportSystem as XMLImportingModuleStoreRuntime