From 934b3ca7c03244ac911de2cd1531a649cbdf7e6d Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Mon, 16 Sep 2013 14:26:39 -0400 Subject: [PATCH] Check has_children before accessing children --- common/lib/xmodule/xmodule/modulestore/mongo/draft.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py index 0f46d3fe0c..b816ab246d 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/draft.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/draft.py @@ -239,7 +239,8 @@ class DraftModuleStore(MongoModuleStore): draft.published_date = datetime.now(UTC) draft.published_by = published_by_id super(DraftModuleStore, self).update_item(location, draft.get_explicitly_set_fields_by_scope(Scope.content)) - super(DraftModuleStore, self).update_children(location, draft.children) + if draft.has_children: + super(DraftModuleStore, self).update_children(location, draft.children) super(DraftModuleStore, self).update_metadata(location, own_metadata(draft)) self.delete_item(location)