From 4341ea7689ee4570749312c7e80392737f5fca12 Mon Sep 17 00:00:00 2001 From: ichuang Date: Sun, 2 Sep 2012 22:40:50 -0400 Subject: [PATCH] fix bug in modulestore reload: etree parser must be specified explicitly --- common/lib/xmodule/xmodule/xml_module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/xml_module.py b/common/lib/xmodule/xmodule/xml_module.py index 25dc4e0c6e..e8ecfa785a 100644 --- a/common/lib/xmodule/xmodule/xml_module.py +++ b/common/lib/xmodule/xmodule/xml_module.py @@ -12,6 +12,9 @@ import sys log = logging.getLogger(__name__) +edx_xml_parser = etree.XMLParser(dtd_validation=False, load_dtd=False, + remove_comments=True, remove_blank_text=True) + def name_to_pathname(name): """ Convert a location name for use in a path: replace ':' with '/'. @@ -146,7 +149,7 @@ class XmlDescriptor(XModuleDescriptor): Returns an lxml Element """ - return etree.parse(file_object).getroot() + return etree.parse(file_object, parser=edx_xml_parser).getroot() @classmethod def load_file(cls, filepath, fs, location):