diff --git a/common/lib/xmodule/capa_module.py b/common/lib/xmodule/capa_module.py index c7b52ae8ba..55534f8a3e 100644 --- a/common/lib/xmodule/capa_module.py +++ b/common/lib/xmodule/capa_module.py @@ -222,6 +222,8 @@ class Module(XModule): self.weight=only_one(dom2.xpath('/problem/@weight')) if self.rerandomize == 'never': seed = 1 + elif self.rerandomize == "per_student" and hasattr(system, 'id'): + seed = system.id else: seed = None try: diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index 7c4de7d499..3b42ac51e7 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -31,7 +31,7 @@ class I4xSystem(object): functionality. ''' def __init__(self, ajax_url, track_function, render_function, - render_template, filestore=None): + render_template, request=None, filestore=None): ''' Create a closure around the system environment. @@ -46,6 +46,7 @@ class I4xSystem(object): and 'type'. render_template - a function that takes (template_file, context), and returns rendered html. + request - the request in progress filestore - A filestore ojbect. Defaults to an instance of OSFS based at settings.DATA_DIR. ''' @@ -62,6 +63,7 @@ class I4xSystem(object): self.render_template = render_template self.exception404 = Http404 self.DEBUG = settings.DEBUG + self.id = request.user.id if request is not None else 0 def get(self, attr): ''' provide uniform access to attributes (like etree).''' @@ -169,6 +171,7 @@ def get_module(user, request, module_xml, student_module_cache, position=None): render_function = render_function, render_template = render_to_string, ajax_url = ajax_url, + request = request, filestore = OSFS(data_root), ) # pass position specified in URL to module through I4xSystem @@ -300,6 +303,7 @@ def modx_dispatch(request, module=None, dispatch=None, id=None): render_function = None, render_template = render_to_string, ajax_url = ajax_url, + request = request, filestore = OSFS(data_root), )