From 376575dedd26dc935e2171e5f51aef353f9f1e12 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 23 Jan 2013 11:34:24 -0500 Subject: [PATCH] Make system.xblock_model_data more explicit to fix the problem where error descriptors can't get any data because the schema and the data don't match. --- cms/djangoapps/contentstore/views.py | 4 ++-- common/lib/xmodule/xmodule/tests/__init__.py | 2 +- common/lib/xmodule/xmodule/x_module.py | 2 +- lms/djangoapps/courseware/module_render.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index 2fd395cff9..614dd85d34 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -454,9 +454,9 @@ def preview_module_system(request, preview_id, descriptor): descriptor: An XModuleDescriptor """ - def preview_model_data(model_data): + def preview_model_data(descriptor): return DbModel( - SessionKeyValueStore(request, model_data), + SessionKeyValueStore(request, descriptor._model_data), descriptor.module_class, preview_id, MongoUsage(preview_id, descriptor.location.url()), diff --git a/common/lib/xmodule/xmodule/tests/__init__.py b/common/lib/xmodule/xmodule/tests/__init__.py index e8b71b53fc..2db8523a72 100644 --- a/common/lib/xmodule/xmodule/tests/__init__.py +++ b/common/lib/xmodule/xmodule/tests/__init__.py @@ -31,7 +31,7 @@ i4xs = ModuleSystem( xqueue={'interface':None, 'callback_url':'/', 'default_queuename': 'testqueue', 'waittime': 10}, node_path=os.environ.get("NODE_PATH", "/usr/local/lib/node_modules"), anonymous_student_id = 'student', - xblock_model_data = lambda x: x, + xblock_model_data = lambda descriptor: descriptor._model_data, ) diff --git a/common/lib/xmodule/xmodule/x_module.py b/common/lib/xmodule/xmodule/x_module.py index 3526990745..78489f05f4 100644 --- a/common/lib/xmodule/xmodule/x_module.py +++ b/common/lib/xmodule/xmodule/x_module.py @@ -362,7 +362,7 @@ class XModuleDescriptor(HTMLSnippet, ResourceTemplates, XBlock): system, self.location, self, - system.xblock_model_data(self._model_data), + system.xblock_model_data(self), ) def has_dynamic_children(self): diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index 4d599d128d..cfa082a329 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -203,9 +203,9 @@ def _get_module(user, request, location, student_module_cache, course_id, positi return get_module(user, request, location, student_module_cache, course_id, position) - def xblock_model_data(descriptor_model_data): + def xblock_model_data(descriptor): return DbModel( - LmsKeyValueStore(course_id, user, descriptor_model_data, student_module_cache), + LmsKeyValueStore(course_id, user, descriptor._model_data, student_module_cache), descriptor.module_class, user.id, LmsUsage(location, location)