From b4793b3277ccd381068ce24702cc513e0d2ece2f Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Dec 2012 12:02:29 -0500 Subject: [PATCH] Add an implementation of get_items to xml module store --- common/lib/xmodule/xmodule/modulestore/xml.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index a6ff6ab26f..b7f1b0da02 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -513,6 +513,18 @@ class XMLModuleStore(ModuleStoreBase): raise NotImplementedError("XMLModuleStores can't guarantee that definitions" " are unique. Use get_instance.") + def get_items(self, location, depth=0): + items = [] + for _, modules in self.modules.iteritems(): + for mod_loc, module in modules.iteritems(): + + # Locations match if each value in `location` is None or if the value from `location` + # matches the value from `mod_loc` + if all(goal is None or goal == value for goal, value in zip(location, mod_loc)): + items.append(module) + + return items + def get_courses(self, depth=0): """