From 83fdeea2bc0c4091dc282e127c8aa0ba6e75e642 Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Fri, 6 Jul 2012 18:22:29 -0400 Subject: [PATCH] Hookup the CourseDescriptor stuff by fixing a fewt push -f dorm issues. --- common/lib/xmodule/xmodule/modulestore/xml.py | 7 +++---- common/lib/xmodule/xmodule/x_module.py | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index 3e6e54be45..4807fa4b63 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -42,7 +42,7 @@ class XMLModuleStore(ModuleStore): self.default_class = class_ for course_dir in os.listdir(self.data_dir): - if not os.path.isdir(course_dir): + if not os.path.exists(self.data_dir + "/" + course_dir + "/course.xml"): continue self.load_course(course_dir) @@ -50,7 +50,6 @@ class XMLModuleStore(ModuleStore): def load_course(self, course_dir): """ Load a course into this module store - course_path: Course directory name """ @@ -91,14 +90,14 @@ class XMLModuleStore(ModuleStore): module = XModuleDescriptor.load_from_xml(etree.tostring(xml_data), self, org, course, modulestore.default_class) modulestore.modules[module.location] = module - if self.eager: + if modulestore.eager: module.get_children() return module system_kwargs = dict( render_template=lambda: '', load_item=modulestore.get_item, - resources_fs=OSFS(self.data_dir / course_dir), + resources_fs=OSFS(modulestore.data_dir / course_dir), process_xml=process_xml ) MakoDescriptorSystem.__init__(self, **system_kwargs) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 8bfbb5f91a..52352c7d2b 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -249,11 +249,11 @@ class XModuleDescriptor(Plugin): rerandomize (string): When to generate a newly randomized instance of the module data """ self.system = system - self.definition = definition if definition is not None else {} - self.name = Location(kwargs.get('location')).name - self.category = Location(kwargs.get('location')).category - self.location = Location(kwargs.get('location')) self.metadata = kwargs.get('metadata', {}) + self.definition = definition if definition is not None else {} + self.location = Location(kwargs.get('location')) + self.name = self.location.name + self.category = self.location.category self.shared_state_key = kwargs.get('shared_state_key') self._child_instances = None