Skip to content

Commit

Permalink
Update mako_block.py to use MakoService
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahQureshee authored Jun 25, 2024
1 parent db4911b commit 6f9c694
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions xmodule/mako_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ class MakoTemplateBlockBase:

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if getattr(self.runtime, 'render_template', None) is None:
raise TypeError(
'{runtime} must have a render_template function'
' in order to use a MakoDescriptor'.format(
runtime=self.runtime,
)
)
# if getattr(self.runtime, 'render_template', None) is None:
# raise TypeError(
# '{runtime} must have a render_template function'
# ' in order to use a MakoDescriptor'.format(
# runtime=self.runtime,
# )
# )

def get_context(self):
"""
Expand All @@ -67,9 +67,10 @@ def studio_view(self, context): # pylint: disable=unused-argument
"""
View used in Studio.
"""
from common.djangoapps.edxmako.services import MakoService
# pylint: disable=no-member
fragment = Fragment(
self.runtime.render_template(self.mako_template, self.get_context())
MakoService().render_template(self.mako_template, self.get_context())
)
shim_xmodule_js(fragment, self.js_module_name)
return fragment

0 comments on commit 6f9c694

Please sign in to comment.