From 60bbfc5a9c48e02c26d271f3665a38a45c1bb246 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Mon, 16 Mar 2015 10:25:38 -0400 Subject: [PATCH] Add @contract to _load_item --- .../lib/xmodule/xmodule/modulestore/mongo/base.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/base.py b/common/lib/xmodule/xmodule/modulestore/mongo/base.py index f4e0d83e2e..0509404a53 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/base.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/base.py @@ -400,6 +400,9 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin): return [] +new_contract('CachingDescriptorSystem', CachingDescriptorSystem) + + # The only thing using this w/ wildcards is contentstore.mongo for asset retrieval def location_to_query(location, wildcard=True, tag='i4x'): """ @@ -852,13 +855,21 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo return data + @contract( + course_key=CourseKey, + item=dict, + apply_cached_metadata=bool, + using_descriptor_system="None|CachingDescriptorSystem" + ) def _load_item(self, course_key, item, data_cache, apply_cached_metadata=True, using_descriptor_system=None): """ Load an XModuleDescriptor from item, using the children stored in data_cache Arguments: course_key (CourseKey): which course to load from - item (UsageKey): which xblock to load + item (dict): A dictionary with the following keys: + location: The serialized UsageKey for the item to load + data_dir (optional): The directory name to use as the root data directory for this XModule data_cache (dict): A dictionary mapping from UsageKeys to xblock field data (this is the xblock data loaded from the database) apply_cached_metadata (bool): Whether to use the cached metadata for inheritance