From b4ead02eea80b04639bcf3a618de0ee2eec24509 Mon Sep 17 00:00:00 2001 From: farhan Date: Fri, 20 Oct 2023 16:07:12 +0500 Subject: [PATCH] refactor: migrate from xblock-utils package to xblock.utils --- build/lib/sql_grader/xblocks.py | 8 ++++++-- requirements/base.in | 1 - sql_grader/xblocks.py | 9 +++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build/lib/sql_grader/xblocks.py b/build/lib/sql_grader/xblocks.py index b08d18e..d3f6208 100644 --- a/build/lib/sql_grader/xblocks.py +++ b/build/lib/sql_grader/xblocks.py @@ -2,8 +2,12 @@ A custom submission type to evaluate SQL queries """ from xblock.core import XBlock -from xblockutils.resources import ResourceLoader -from xblockutils.studio_editable import StudioEditableXBlockMixin +try: + from xblock.utils.resources import ResourceLoader + from xblock.utils.studio_editable import StudioEditableXBlockMixin +except ModuleNotFoundError: # For backward compatibility with releases older than Quince. + from xblockutils.resources import ResourceLoader + from xblockutils.studio_editable import StudioEditableXBlockMixin from .mixins.dates import EnforceDueDates from .mixins.fragment import XBlockFragmentBuilderMixin diff --git a/requirements/base.in b/requirements/base.in index c0c3f34..567cc15 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -3,6 +3,5 @@ Django XBlock -xblock-utils # TODO: Change this once codejail is published to pypi -e git+https://github.com/openedx/codejail.git@3.0.0#egg=codejail diff --git a/sql_grader/xblocks.py b/sql_grader/xblocks.py index b08d18e..2814b18 100644 --- a/sql_grader/xblocks.py +++ b/sql_grader/xblocks.py @@ -2,8 +2,13 @@ A custom submission type to evaluate SQL queries """ from xblock.core import XBlock -from xblockutils.resources import ResourceLoader -from xblockutils.studio_editable import StudioEditableXBlockMixin +try: + from xblock.utils.resources import ResourceLoader + from xblock.utils.studio_editable import StudioEditableXBlockMixin +except ModuleNotFoundError: + # For backward compatibility with releases older than Quince. + from xblockutils.resources import ResourceLoader + from xblockutils.studio_editable import StudioEditableXBlockMixin from .mixins.dates import EnforceDueDates from .mixins.fragment import XBlockFragmentBuilderMixin