diff --git a/invideoquiz/__init__.py b/invideoquiz/__init__.py index 322c4d8..038e650 100644 --- a/invideoquiz/__init__.py +++ b/invideoquiz/__init__.py @@ -3,4 +3,4 @@ """ from .invideoquiz import InVideoQuizXBlock -__version__ = '1.6.0' +__version__ = '1.6.1' diff --git a/invideoquiz/invideoquiz.py b/invideoquiz/invideoquiz.py index 9c5cde4..32dbf37 100644 --- a/invideoquiz/invideoquiz.py +++ b/invideoquiz/invideoquiz.py @@ -6,35 +6,37 @@ import json import os -import pkg_resources - from xblock.core import XBlock from xblock.fields import Scope from xblock.fields import String +from xblock.validation import ValidationMessage try: from web_fragments.fragment import Fragment except ImportError: # For backward compatibility with quince and earlier. from xblock.fragment import Fragment -from xblock.validation import ValidationMessage + try: from xblock.utils.studio_editable import StudioEditableXBlockMixin + from xblock.utils.resources import ResourceLoader except ModuleNotFoundError: # For backward compatibility with releases older than Quince. from xblockutils.studio_editable import StudioEditableXBlockMixin + from xblockutils.resources import ResourceLoader from .utils import _ +resource_loader = ResourceLoader(__name__) + def get_resource_string(path): """ Retrieve string contents for the file path """ path = os.path.join('public', path) - resource_string = pkg_resources.resource_string(__name__, path) - return resource_string.decode('utf8') + return resource_loader.load_unicode(path) class InVideoQuizXBlock(StudioEditableXBlockMixin, XBlock):