Commit ad08df7a by Calen Pennington

Add logging when info and about sections are missing

parent 3011f3f3
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))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment