From 51c65e214afed2c066039915b52cf743aa6d2e0a Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Mon, 9 Jul 2012 15:01:10 -0400 Subject: [PATCH 1/2] Get initial courseware page displaying. --- lms/djangoapps/courseware/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 403a472d42..2415a92c49 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -125,7 +125,7 @@ def render_accordion(request, course, chapter, section): Returns (initialization_javascript, content)''' # TODO (cpennington): do the right thing with courses - toc = toc_for_course(request.user, request, course.location, chapter, section) + toc = toc_for_course(request.user, request, course, chapter, section) active_chapter = 1 for i in range(len(toc)): From 4aacace056fe3b6f14361eaa913a4588a9d5f4c1 Mon Sep 17 00:00:00 2001 From: Bridger Maxwell Date: Mon, 9 Jul 2012 15:54:36 -0400 Subject: [PATCH 2/2] Fixed exception type when about or info section missing. --- common/lib/xmodule/xmodule/course_module.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 73949dcc19..73fcd93d45 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -1,7 +1,10 @@ +from fs.errors import ResourceNotFoundError from path import path + from xmodule.modulestore import Location from xmodule.seq_module import SequenceDescriptor, SequenceModule + class CourseDescriptor(SequenceDescriptor): module_class = SequenceModule @@ -51,7 +54,7 @@ class CourseDescriptor(SequenceDescriptor): try: with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: return htmlFile.read() - except IOError: + except ResourceNotFoundError: return "! About section missing !" elif section_key == "title": return self.name @@ -79,7 +82,7 @@ class CourseDescriptor(SequenceDescriptor): try: with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile: return htmlFile.read() - except IOError: - return "! About section missing !" + except ResourceNotFoundError: + return "! Info section missing !" raise KeyError("Invalid about key " + str(section_key))