Provide implicit saves for XBlocks and XModules.

Update existing tests and provide new ones to test new paradigm.
This commit is contained in:
Diana Huang
2013-07-03 14:38:22 -04:00
committed by Sarina Canelake
parent f0c9aa3916
commit 3f9431e8cf
25 changed files with 349 additions and 105 deletions

View File

@@ -89,6 +89,21 @@ def grade_histogram(module_id):
return grades
def save_module(get_html, module):
"""
Updates the given get_html function for the given module to save the fields
after rendering.
"""
@wraps(get_html)
def _get_html():
"""Cache the rendered output, save, then return the output."""
rendered_html = get_html()
module.save()
return rendered_html
return _get_html
def add_histogram(get_html, module, user):
"""
Updates the supplied module with a new get_html function that wraps