From 9c5b0ba6ea6e9aa9d606de2075a3615367d87c6c Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 19 Sep 2012 14:54:41 -0400 Subject: [PATCH] Create the data dir to put files in, if it doesn't exist when loading a module from mongo --- common/lib/xmodule/xmodule/modulestore/mongo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo.py b/common/lib/xmodule/xmodule/modulestore/mongo.py index 33901947a6..882fa9dda1 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -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,