From 7aa97d2999fb8506c8e00aae63192dc049cc9700 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 12 Mar 2013 16:06:40 -0400 Subject: [PATCH] Do metadata name translation in the mongo modulestore (because it isn't using from_json) --- 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 f1f4d43eb5..c7361e4d68 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -152,10 +152,15 @@ class CachingDescriptorSystem(MakoDescriptorSystem): self.default_class ) definition = json_data.get('definition', {}) + metadata = json_data.get('metadata', {}) + for old_name, new_name in class_.metadata_tranlations.items(): + metadata[new_name] = metadata[old_name] + del metadata[old_name] + kvs = MongoKeyValueStore( definition.get('data', {}), definition.get('children', []), - json_data.get('metadata', {}), + metadata, ) model_data = DbModel(kvs, class_, None, MongoUsage(self.course_id, location))