diff --git a/common/lib/xmodule/xmodule/template_module.py b/common/lib/xmodule/xmodule/template_module.py index 064d48f431..268ce24559 100644 --- a/common/lib/xmodule/xmodule/template_module.py +++ b/common/lib/xmodule/xmodule/template_module.py @@ -1,6 +1,7 @@ from xmodule.x_module import XModule from xmodule.raw_module import RawDescriptor from lxml import etree +from mako.template import Template class CustomTagModule(XModule): @@ -30,9 +31,10 @@ class CustomTagModule(XModule): def __init__(self, system, location, definition, instance_state=None, shared_state=None, **kwargs): XModule.__init__(self, system, location, definition, instance_state, shared_state, **kwargs) xmltree = etree.fromstring(self.definition['data']) - filename = xmltree.find('impl').text + template_name = xmltree.find('impl').text params = dict(xmltree.items()) - self.html = self.system.render_template(filename, params, namespace='custom_tags') + with self.system.filestore.open('custom_tags/{name}'.format(name=template_name)) as template: + self.html = Template(template.read()).render(**params) def get_html(self): return self.html diff --git a/lms/envs/common.py b/lms/envs/common.py index 928aa2bd01..5cf3848d13 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -69,21 +69,15 @@ sys.path.append(COMMON_ROOT / 'lib') # templates MAKO_MODULE_DIR = tempfile.mkdtemp('mako') MAKO_TEMPLATES = {} -MAKO_TEMPLATES['course'] = [DATA_DIR] -MAKO_TEMPLATES['sections'] = [DATA_DIR / 'sections'] -MAKO_TEMPLATES['custom_tags'] = [DATA_DIR / 'custom_tags'] MAKO_TEMPLATES['main'] = [PROJECT_ROOT / 'templates', COMMON_ROOT / 'templates', COMMON_ROOT / 'lib' / 'capa' / 'templates', - COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates', - DATA_DIR / 'info', - DATA_DIR / 'problems'] + COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates'] # This is where Django Template lookup is defined. There are a few of these # still left lying around. TEMPLATE_DIRS = ( PROJECT_ROOT / "templates", - DATA_DIR / "problems", ) TEMPLATE_CONTEXT_PROCESSORS = (