Commit 5ae2668e by Calen Pennington

Merge pull request #43 from MITx/pmitros/same-values

Courseware can have same random seed in multiple problems for exam. 
parents 40a950f1 f391e9c5
......@@ -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:
......
......@@ -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),
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment