Create the data dir to put files in, if it doesn't exist when loading a module from mongo

This commit is contained in:
Calen Pennington
2012-09-19 14:54:41 -04:00
parent eb20e47160
commit 9c5b0ba6ea

View File

@@ -153,7 +153,12 @@ class MongoModuleStore(ModuleStoreBase):
Load an XModuleDescriptor from item, using the children stored in data_cache
"""
data_dir = item.get('metadata', {}).get('data_dir', item['location']['course'])
resource_fs = OSFS(self.fs_root / data_dir)
root = self.fs_root / data_dir
if not root.isdir():
root.mkdir()
resource_fs = OSFS(root)
system = CachingDescriptorSystem(
self,