diff --git a/feedback/extensions/filters.py b/feedback/extensions/filters.py index 8fac1a3..b8b51e5 100644 --- a/feedback/extensions/filters.py +++ b/feedback/extensions/filters.py @@ -1,7 +1,7 @@ """ Open edX Filters needed for instructor dashboard integration. """ -import pkg_resources +import importlib.resources from crum import get_current_request from django.conf import settings from django.template import Context, Template @@ -75,8 +75,7 @@ def run_filter( def resource_string(self, path): """Handy helper for getting resources from our kit.""" - data = pkg_resources.resource_string("feedback", path) - return data.decode("utf8") + return importlib.resources.files("feedback").joinpath(path).read_text() def load_blocks(request, course): diff --git a/feedback/feedback.py b/feedback/feedback.py index e778f21..45239af 100644 --- a/feedback/feedback.py +++ b/feedback/feedback.py @@ -8,19 +8,21 @@ import html import random -import pkg_resources -import six +import importlib.resources +import six +from web_fragments.fragment import Fragment from xblock.core import XBlock from xblock.fields import Scope, Integer, String, List, Float, Boolean -from web_fragments.fragment import Fragment + from feedback.utils import _ + try: from xblock.utils.resources import ResourceLoader except ModuleNotFoundError: # For backward compatibility with releases older than Quince. from xblockutils.resources import ResourceLoader -resource_loader = ResourceLoader(__name__) +resource_loader = ResourceLoader(__package__) # We provide default text which is designed to elicit student thought. We'd # like instructors to customize this to something highly structured (not @@ -133,8 +135,7 @@ class FeedbackXBlock(XBlock): @classmethod def resource_string(cls, path): """Handy helper for getting resources from our kit.""" - data = pkg_resources.resource_string(__name__, path) - return data.decode("utf8") + return importlib.resources.files(__package__).joinpath(path).read_text() def get_prompt(self, index=-1): """ diff --git a/setup.py b/setup.py index 36de380..ef5840a 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def package_data(pkg, roots): setup( name='feedback-xblock', - version='1.6.0', + version='1.6.1', description='XBlock for providing feedback on course content', long_description=README, long_description_content_type='text/x-rst',