Skip to content

Commit

Permalink
chore: used resource loader for static resource loading
Browse files Browse the repository at this point in the history
  • Loading branch information
beingfaisal committed Sep 10, 2024
1 parent f7bd086 commit a00a64f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions audio/audio.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""TO-DO: This XBlock will play an MP3 file as an HTML5 audio element. """


import importlib.resources
from xblock.core import XBlock
from xblock.fields import Integer, Scope, String
from xblock.fragment import Fragment
Expand Down Expand Up @@ -35,8 +34,7 @@ class AudioXBlock(XBlock):
@staticmethod
def resource_string(path):
"""Handy helper for getting resources from our kit."""
data = importlib.resources.files(__package__).joinpath(path)
return data.read_text(encoding="utf-8")
return resource_loader.load_unicode(path)

# TO-DO: change this view to display your data your own way.
def student_view(self, context=None):
Expand Down

0 comments on commit a00a64f

Please sign in to comment.