From e172be3a26dd06b8fdd657d05ccee3d2f0c75ae9 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 2 Jul 2012 19:55:42 -0400 Subject: [PATCH] Make XML import pass in an empty render_template function --- common/lib/xmodule/xmodule/modulestore/xml.py | 12 ++++++++++-- common/lib/xmodule/xmodule/x_module.py | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index d4e90d59a4..a5db17054b 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -4,6 +4,7 @@ from importlib import import_module from lxml import etree from path import path from xmodule.x_module import XModuleDescriptor, XMLParsingSystem +from xmodule.mako_module import MakoDescriptorSystem from . import ModuleStore, Location from .exceptions import ItemNotFoundError @@ -38,7 +39,7 @@ class XMLModuleStore(ModuleStore): self.default_class = class_ with open(self.data_dir / "course.xml") as course_file: - class ImportSystem(XMLParsingSystem): + class ImportSystem(XMLParsingSystem, MakoDescriptorSystem): def __init__(self, modulestore): """ modulestore: the XMLModuleStore to store the loaded modules in @@ -73,7 +74,14 @@ class XMLModuleStore(ModuleStore): module.get_children() return module - XMLParsingSystem.__init__(self, modulestore.get_item, OSFS(data_dir), process_xml) + system_kwargs = dict( + render_template=lambda: '', + load_item=modulestore.get_item, + resources_fs=OSFS(data_dir), + process_xml=process_xml + ) + MakoDescriptorSystem.__init__(self, **system_kwargs) + XMLParsingSystem.__init__(self, **system_kwargs) self.course = ImportSystem(self).process_xml(course_file.read()) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 9f56d95fe5..8bfbb5f91a 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -422,7 +422,7 @@ class XModuleDescriptor(Plugin): class DescriptorSystem(object): - def __init__(self, load_item, resources_fs): + def __init__(self, load_item, resources_fs, **kwargs): """ load_item: Takes a Location and returns an XModuleDescriptor resources_fs: A Filesystem object that contains all of the @@ -434,7 +434,7 @@ class DescriptorSystem(object): class XMLParsingSystem(DescriptorSystem): - def __init__(self, load_item, resources_fs, process_xml): + def __init__(self, load_item, resources_fs, process_xml, **kwargs): """ process_xml: Takes an xml string, and returns the the XModuleDescriptor created from that xml """