Hookup the CourseDescriptor stuff by fixing a fewt push -f dorm issues.

This commit is contained in:
Matthew Mongeau
2012-07-06 18:22:29 -04:00
parent 5109253378
commit 83fdeea2bc
2 changed files with 7 additions and 8 deletions

View File

@@ -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)

View File

@@ -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