From ebf6d07607c784ed3a47bf4a69cedd6f972a11f9 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 3 Oct 2012 12:36:35 -0400 Subject: [PATCH] add a 'safety switch' where we add new content into GridFS with a filename (which GridFS maintains an index on) in case any assumptions about our new id scheme proves to be false. We can query by filename (which is a /tag/org/course/category/name format) so it'll be unique --- common/lib/xmodule/xmodule/contentstore/mongo.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/contentstore/mongo.py b/common/lib/xmodule/xmodule/contentstore/mongo.py index 4b620e5abe..5560624720 100644 --- a/common/lib/xmodule/xmodule/contentstore/mongo.py +++ b/common/lib/xmodule/xmodule/contentstore/mongo.py @@ -28,9 +28,10 @@ class MongoContentStore(ContentStore): if self.fs.exists({"_id" : id}): self.fs.delete(id) - with self.fs.new_file(_id = id, content_type=content.content_type, displayname=content.name) as fp: + with self.fs.new_file(_id = id, filename=content.get_url_path(), content_type=content.content_type, displayname=content.name) as fp: fp.write(content.data) - return content + + return content def find(self, location):