get_courses doesn't return ErrorDescriptor
This commit is contained in:
@@ -557,7 +557,7 @@ class MongoModuleStore(ModuleStoreWriteBase):
|
||||
'''
|
||||
Returns a list of course descriptors.
|
||||
'''
|
||||
return sum(
|
||||
base_list = sum(
|
||||
[
|
||||
self._load_items(
|
||||
SlashSeparatedCourseKey(course['_id']['org'], course['_id']['course'], course['_id']['name']),
|
||||
@@ -574,6 +574,7 @@ class MongoModuleStore(ModuleStoreWriteBase):
|
||||
],
|
||||
[]
|
||||
)
|
||||
return [course for course in base_list if not isinstance(course, ErrorDescriptor)]
|
||||
|
||||
def _find_one(self, location):
|
||||
'''Look for a given location in the collection. If revision is not
|
||||
|
||||
@@ -70,6 +70,7 @@ from bson.objectid import ObjectId
|
||||
from xmodule.modulestore.split_mongo.mongo_connection import MongoConnection
|
||||
from xblock.core import XBlock
|
||||
from xmodule.modulestore.loc_mapper_store import LocMapperStore
|
||||
from xmodule.error_module import ErrorDescriptor
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
#==============================================================================
|
||||
@@ -313,7 +314,9 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
|
||||
'structure': entry,
|
||||
}
|
||||
root = entry['root']
|
||||
result.extend(self._load_items(envelope, [root], 0, lazy=True))
|
||||
course_list = self._load_items(envelope, [root], 0, lazy=True)
|
||||
if not isinstance(course_list[0], ErrorDescriptor):
|
||||
result.append(course_list[0])
|
||||
return result
|
||||
|
||||
def get_course(self, course_id, depth=None):
|
||||
|
||||
Reference in New Issue
Block a user