From e61a953199efc5828a3fc63146eadceeb60ab91e Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Tue, 9 Jan 2024 09:48:18 -0500 Subject: [PATCH] chore: fix depr warning by updating import: xblockutils -> xblock.utils Context: https://github.com/openedx/XBlock/issues/675 This fixes some edx-platform warnings: /openedx/venv/lib/python3.8/site-packages/poll/poll.py:40: DeprecatedPackageWarning: Please use import xblock.utils.publish_event instead of xblockutils.publish_event because the 'xblock-utils' package has been deprecated and migrated to within 'xblock' package. Uses a try-catch for backwards compatibility with pre-Quince versions of xblock and xblockutils. Bump from 1.13.0 to 1.13.1 --- poll/poll.py | 13 +++++++++---- setup.py | 2 +- tests/integration/base_test.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/poll/poll.py b/poll/poll.py index dca03ad..3c3c5c3 100644 --- a/poll/poll.py +++ b/poll/poll.py @@ -32,14 +32,19 @@ import six from django import utils from markdown import markdown -from webob import Response from xblock.completable import XBlockCompletionMode from xblock.core import XBlock from xblock.fields import Boolean, Dict, Integer, List, Scope, String +try: + from xblock.utils.publish_event import PublishEventMixin + from xblock.utils.resources import ResourceLoader + from xblock.utils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin +except ModuleNotFoundError: # For backward compatibility with releases older than Quince. + from xblockutils.publish_event import PublishEventMixin + from xblockutils.resources import ResourceLoader + from xblockutils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin +from webob import Response from web_fragments.fragment import Fragment -from xblockutils.publish_event import PublishEventMixin -from xblockutils.resources import ResourceLoader -from xblockutils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin from .utils import DummyTranslationService, _, remove_markdown_and_html_tags diff --git a/setup.py b/setup.py index df5af4b..59e5912 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ def package_data(pkg, roots): setup( name='xblock-poll', - version='1.13.0', + version='1.13.1', description='An XBlock for polling users.', long_description=README, long_description_content_type='text/markdown', diff --git a/tests/integration/base_test.py b/tests/integration/base_test.py index efedcf4..5bae789 100644 --- a/tests/integration/base_test.py +++ b/tests/integration/base_test.py @@ -22,9 +22,9 @@ # from __future__ import absolute_import -from xblockutils.base_test import SeleniumBaseTest from mock import patch +from xblock.utils.base_test import SeleniumBaseTest # Default names for inputs for polls/surveys DEFAULT_SURVEY_NAMES = ('enjoy', 'recommend', 'learn')