Commit e66cb05c by John Eskew

Return empty values and log a warning instead of raising NotImplemented

exceptions for XML modulestore asset metadata methods.
parent 2341bf1d
......@@ -285,7 +285,8 @@ class ModuleStoreAssetInterface(object):
Returns the container holding a dict indexed by asset block_type whose values are a list
of raw metadata documents
"""
raise NotImplementedError()
log.warning("_find_course_assets request of ModuleStoreAssetInterface - not implemented.")
return None
def _find_course_asset(self, asset_key):
"""
......
......@@ -455,14 +455,10 @@ class TestMongoAssetMetadataStorage(unittest.TestCase):
with storebuilder.build(None) as store:
course_key = store.make_course_key("org", "course", "run")
asset_key = course_key.make_asset_key('asset', 'foo.jpg')
for method in ['find_asset_metadata']:
with self.assertRaises(NotImplementedError):
getattr(store, method)(asset_key)
with self.assertRaises(NotImplementedError):
# pylint: disable=protected-access
store._find_course_asset(asset_key)
with self.assertRaises(NotImplementedError):
store.get_all_asset_metadata(course_key, 'asset')
self.assertEquals(store.find_asset_metadata(asset_key), None)
# pylint: disable=protected-access
self.assertEquals(store._find_course_asset(asset_key), (None, None))
self.assertEquals(store.get_all_asset_metadata(course_key, 'asset'), [])
@ddt.data(*MODULESTORE_SETUPS)
def test_copy_all_assets_same_modulestore(self, storebuilder):
......
......@@ -867,18 +867,21 @@ class XMLModuleStore(ModuleStoreReadBase):
For now this is not implemented, but others should feel free to implement using the asset.json
which export produces.
"""
raise NotImplementedError()
log.warning("_find_course_asset request of XML modulestore - not implemented.")
return (None, None)
def find_asset_metadata(self, asset_key, **kwargs):
"""
For now this is not implemented, but others should feel free to implement using the asset.json
which export produces.
"""
raise NotImplementedError()
log.warning("find_asset_metadata request of XML modulestore - not implemented.")
return None
def get_all_asset_metadata(self, course_key, asset_type, start=0, maxresults=-1, sort=None, **kwargs):
"""
For now this is not implemented, but others should feel free to implement using the asset.json
which export produces.
"""
raise NotImplementedError()
log.warning("get_all_asset_metadata request of XML modulestore - not implemented.")
return []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment