From bff8cd4e4ee96e09c74d9faf2c20b6c9ee790831 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Mon, 10 Sep 2012 10:10:25 -0400 Subject: [PATCH] don't break courseware if S3 is unreachable --- common/lib/xmodule/xmodule/course_module.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index f00a22782c..4a009dcae4 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -99,7 +99,14 @@ class CourseDescriptor(SequenceDescriptor): def definition_from_xml(cls, xml_object, system): textbooks = [] for textbook in xml_object.findall("textbook"): - textbooks.append(cls.Textbook.from_xml_object(textbook)) + try: + txt = cls.Textbook.from_xml_object(textbook) + except: + # If we can't get to S3 (e.g. on a train with no internet), don't break + # the rest of the courseware. + log.exception("Couldn't load textbook") + continue + textbooks.append() xml_object.remove(textbook) #Load the wiki tag if it exists