Commit 4ded4be7 by Calen Pennington

Fix calls to get_module to not pass course ids as positions

parent 36352fa5
...@@ -187,7 +187,6 @@ def get_course_about_section(course, section_key): ...@@ -187,7 +187,6 @@ def get_course_about_section(course, section_key):
request, request,
loc, loc,
field_data_cache, field_data_cache,
course.id,
log_if_not_found=False, log_if_not_found=False,
wrap_xmodule_display=False, wrap_xmodule_display=False,
static_asset_path=course.static_asset_path static_asset_path=course.static_asset_path
...@@ -241,7 +240,6 @@ def get_course_info_section(request, course, section_key): ...@@ -241,7 +240,6 @@ def get_course_info_section(request, course, section_key):
request, request,
usage_key, usage_key,
field_data_cache, field_data_cache,
course.id,
log_if_not_found=False, log_if_not_found=False,
wrap_xmodule_display=False, wrap_xmodule_display=False,
static_asset_path=course.static_asset_path static_asset_path=course.static_asset_path
......
...@@ -504,7 +504,15 @@ def get_module_system_for_user(user, field_data_cache, ...@@ -504,7 +504,15 @@ def get_module_system_for_user(user, field_data_cache,
) )
# pass position specified in URL to module through ModuleSystem # pass position specified in URL to module through ModuleSystem
if position is not None:
try:
position = int(position)
except (ValueError, TypeError):
log.exception('Non-integer %r passed as position.', position)
position = None
system.set('position', position) system.set('position', position)
if settings.FEATURES.get('ENABLE_PSYCHOMETRICS'): if settings.FEATURES.get('ENABLE_PSYCHOMETRICS'):
system.set( system.set(
'psychometrics_handler', # set callback for updating PsychometricsData 'psychometrics_handler', # set callback for updating PsychometricsData
......
...@@ -68,7 +68,7 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -68,7 +68,7 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
def test_get_module(self): def test_get_module(self):
self.assertEqual( self.assertEqual(
None, None,
render.get_module('dummyuser', None, 'invalid location', None, None) render.get_module('dummyuser', None, 'invalid location', None)
) )
def test_module_render_with_jump_to_id(self): def test_module_render_with_jump_to_id(self):
...@@ -90,7 +90,6 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase): ...@@ -90,7 +90,6 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
mock_request, mock_request,
self.course_key.make_usage_key('html', 'toyjumpto'), self.course_key.make_usage_key('html', 'toyjumpto'),
field_data_cache, field_data_cache,
self.course_key
) )
# get the rendered HTML output which should have the rewritten link # get the rendered HTML output which should have the rewritten link
...@@ -414,7 +413,6 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -414,7 +413,6 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
wrap_xmodule_display=True, wrap_xmodule_display=True,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
...@@ -427,7 +425,6 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -427,7 +425,6 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
wrap_xmodule_display=False, wrap_xmodule_display=False,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
...@@ -440,7 +437,6 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -440,7 +437,6 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
...@@ -458,7 +454,6 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -458,7 +454,6 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
...@@ -481,7 +476,6 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -481,7 +476,6 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
static_asset_path="toy_course_dir", static_asset_path="toy_course_dir",
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
...@@ -508,7 +502,6 @@ class TestHtmlModifiers(ModuleStoreTestCase): ...@@ -508,7 +502,6 @@ class TestHtmlModifiers(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
...@@ -546,7 +539,6 @@ class ViewInStudioTest(ModuleStoreTestCase): ...@@ -546,7 +539,6 @@ class ViewInStudioTest(ModuleStoreTestCase):
self.request, self.request,
location, location,
field_data_cache, field_data_cache,
course_id,
) )
def setup_mongo_course(self, course_edit_method='Studio'): def setup_mongo_course(self, course_edit_method='Studio'):
...@@ -693,7 +685,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase): ...@@ -693,7 +685,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
self.assertNotIn('Staff Debug', result_fragment.content) self.assertNotIn('Staff Debug', result_fragment.content)
...@@ -704,7 +695,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase): ...@@ -704,7 +695,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
self.assertIn('Staff Debug', result_fragment.content) self.assertIn('Staff Debug', result_fragment.content)
...@@ -716,7 +706,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase): ...@@ -716,7 +706,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
result_fragment = module.render(STUDENT_VIEW) result_fragment = module.render(STUDENT_VIEW)
self.assertNotIn('histrogram', result_fragment.content) self.assertNotIn('histrogram', result_fragment.content)
...@@ -740,7 +729,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase): ...@@ -740,7 +729,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
self.request, self.request,
html_descriptor.location, html_descriptor.location,
field_data_cache, field_data_cache,
self.course.id,
) )
module.render(STUDENT_VIEW) module.render(STUDENT_VIEW)
self.assertFalse(mock_grade_histogram.called) self.assertFalse(mock_grade_histogram.called)
...@@ -763,7 +751,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase): ...@@ -763,7 +751,6 @@ class TestStaffDebugInfo(ModuleStoreTestCase):
self.request, self.request,
self.location, self.location,
self.field_data_cache, self.field_data_cache,
self.course.id,
) )
module.render(STUDENT_VIEW) module.render(STUDENT_VIEW)
self.assertTrue(mock_grade_histogram.called) self.assertTrue(mock_grade_histogram.called)
...@@ -929,7 +916,6 @@ class TestXmoduleRuntimeEvent(TestSubmittingProblems): ...@@ -929,7 +916,6 @@ class TestXmoduleRuntimeEvent(TestSubmittingProblems):
mock_request, mock_request,
self.problem.location, self.problem.location,
field_data_cache, field_data_cache,
self.course.id
)._xmodule )._xmodule
def set_module_grade_using_publish(self, grade_dict): def set_module_grade_using_publish(self, grade_dict):
...@@ -978,7 +964,7 @@ class TestRebindModule(TestSubmittingProblems): ...@@ -978,7 +964,7 @@ class TestRebindModule(TestSubmittingProblems):
mock_request, mock_request,
self.lti.location, self.lti.location,
field_data_cache, field_data_cache,
self.course.id)._xmodule )._xmodule
def test_rebind_noauth_module_to_user_not_anonymous(self): def test_rebind_noauth_module_to_user_not_anonymous(self):
""" """
......
...@@ -870,7 +870,7 @@ def get_static_tab_contents(request, course, tab): ...@@ -870,7 +870,7 @@ def get_static_tab_contents(request, course, tab):
course.id, request.user, modulestore().get_item(loc), depth=0 course.id, request.user, modulestore().get_item(loc), depth=0
) )
tab_module = get_module( tab_module = get_module(
request.user, request, loc, field_data_cache, course.id, static_asset_path=course.static_asset_path request.user, request, loc, field_data_cache, static_asset_path=course.static_asset_path
) )
logging.debug('course_module = {0}'.format(tab_module)) logging.debug('course_module = {0}'.format(tab_module))
......
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