Skip to content

Commit

Permalink
upgrade: remove pkg_resource
Browse files Browse the repository at this point in the history
  • Loading branch information
arbimaq authored and abdullahQureshee committed Sep 9, 2024
1 parent fccdf30 commit 85e8c44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion invideoquiz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""
from .invideoquiz import InVideoQuizXBlock

__version__ = '1.6.0'
__version__ = '1.6.1'
12 changes: 7 additions & 5 deletions invideoquiz/invideoquiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 85e8c44

Please sign in to comment.