From ad08df7abda4adf83b8f5d847944f192dd418d73 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 10 Jul 2012 09:32:18 -0400 Subject: [PATCH] Add logging when info and about sections are missing --- common/lib/xmodule/xmodule/course_module.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 8056b7f7eb..8bdd5509b9 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -1,8 +1,12 @@ +import logging from path import path from xmodule.modulestore import Location from xmodule.seq_module import SequenceDescriptor, SequenceModule from fs.errors import ResourceNotFoundError +log = logging.getLogger(__name__) + + class CourseDescriptor(SequenceDescriptor): module_class = SequenceModule @@ -53,6 +57,7 @@ class CourseDescriptor(SequenceDescriptor): with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: return htmlFile.read() except ResourceNotFoundError: + log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url())) return "! About section missing !" elif section_key == "title": return self.metadata.get('display_name', self.name) @@ -81,6 +86,7 @@ class CourseDescriptor(SequenceDescriptor): with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile: return htmlFile.read() except ResourceNotFoundError: + log.exception("Missing info section {key} in course {url}".format(key=section_key, url=self.location.url())) return "! About section missing !" raise KeyError("Invalid about key " + str(section_key))