Add logging of filename when module file parsing fails

This commit is contained in:
Calen Pennington
2012-07-02 20:01:01 -04:00
parent e172be3a26
commit 3355f804d1
2 changed files with 11 additions and 1 deletions

View File

@@ -3,6 +3,10 @@ This config file runs the simplest dev environment"""
from .common import *
import logging
import sys
logging.basicConfig(stream=sys.stdout, )
DEBUG = True
TEMPLATE_DEBUG = DEBUG

View File

@@ -2,7 +2,9 @@ from collections import MutableMapping
from xmodule.x_module import XModuleDescriptor
from lxml import etree
import copy
import logging
log = logging.getLogger(__name__)
class LazyLoadingDict(MutableMapping):
"""
@@ -124,7 +126,11 @@ class XmlDescriptor(XModuleDescriptor):
else:
filepath = cls._format_filepath(xml_object.tag, filename)
with system.resources_fs.open(filepath) as file:
definition_xml = etree.parse(file).getroot()
try:
definition_xml = etree.parse(file).getroot()
except:
log.exception("Failed to parse xml in file %s" % filepath)
raise
cls.clean_metadata_from_xml(definition_xml)
return cls.definition_from_xml(definition_xml, system)