From 393aa1da267e440af553b83985f8aba04a47c24c Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Mon, 29 Jul 2013 12:23:19 -0400 Subject: [PATCH] Ensure parent update of children decaches correctly --- common/lib/xmodule/xmodule/x_module.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 5c8324e2ee..f53a2b5f8b 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -616,10 +616,13 @@ class XModuleDescriptor(XModuleFields, HTMLSnippet, ResourceTemplates, XBlock): new_block = system.xblock_from_json(cls, usage_id, json_data) if parent_xblock is not None: - parent_xblock.children.append(new_block) - # decache pending children field settings (Note, truly persisting at this point would break b/c - # persistence assumes children is a list of ids not actual xblocks) - parent_xblock.save() + children = parent_xblock.children + children.append(new_block) + # trigger setter method by using top level field access + parent_xblock.children = children + # decache pending children field settings (Note, truly persisting at this point would break b/c + # persistence assumes children is a list of ids not actual xblocks) + parent_xblock.save() return new_block @classmethod