From a78c21db10a91670407e141b164a792bdd2179b2 Mon Sep 17 00:00:00 2001 From: Giovanni Cimolin da Silva Date: Tue, 10 Dec 2019 09:39:27 -0300 Subject: [PATCH] Fix course export issue --- common/lib/xmodule/xmodule/contentstore/mongo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/contentstore/mongo.py b/common/lib/xmodule/xmodule/contentstore/mongo.py index 1bc89f5cec..85bc0a9d41 100644 --- a/common/lib/xmodule/xmodule/contentstore/mongo.py +++ b/common/lib/xmodule/xmodule/contentstore/mongo.py @@ -324,12 +324,14 @@ class MongoContentStore(ContentStore): # Set values if result of query is empty count = 0 assets = [] - - if cursor.alive: + try: result = cursor.next() if result: count = result['count'] assets = list(result['results']) + except StopIteration: + # Skip if no assets were returned + pass # We're constructing the asset key immediately after retrieval from the database so that # callers are insulated from knowing how our identifiers are stored.