Skip to content

Commit

Permalink
chore: fix depr warning by updating import: xblockutils -> xblock.utils
Browse files Browse the repository at this point in the history
Context: openedx/XBlock#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
  • Loading branch information
kdmccormick committed Jan 9, 2024
1 parent 895c2a5 commit 80ab62d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
12 changes: 9 additions & 3 deletions poll/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@
from xblock.core import XBlock
from xblock.fields import Boolean, Dict, Integer, List, Scope, String
from web_fragments.fragment import Fragment
from xblockutils.publish_event import PublishEventMixin
from xblockutils.resources import ResourceLoader
from xblockutils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin

try:
from xblock.utils.publish_event import PublishEventMixin
from xblock.utils.resources import ResourceLoader
from xblock.utils.settings import ThemableXBlockMixin, XBlockWithSettingsMixin
except ImportError: # 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 .utils import DummyTranslationService, _, remove_markdown_and_html_tags

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
#

from __future__ import absolute_import
from xblockutils.base_test import SeleniumBaseTest
from mock import patch

try:
from xblock.utils.base_test import SeleniumBaseTest
except ImportError: # For backward compatibility with releases older than Quince.
from xblockutils.base_test import SeleniumBaseTest

# Default names for inputs for polls/surveys
DEFAULT_SURVEY_NAMES = ('enjoy', 'recommend', 'learn')
Expand Down

0 comments on commit 80ab62d

Please sign in to comment.