diff --git a/common/djangoapps/pipeline_mako/__init__.py b/common/djangoapps/pipeline_mako/__init__.py index dd1c9d26aa..d8987550a4 100644 --- a/common/djangoapps/pipeline_mako/__init__.py +++ b/common/djangoapps/pipeline_mako/__init__.py @@ -128,17 +128,17 @@ def render_require_js_path_overrides(path_overrides): # pylint: disable=invalid ''' new_paths = [] - for url_path in path_overrides: + for module in path_overrides: # Calculate the full URL, including any hashes added to the filename by the pipeline. # This will also include the base static URL (for example, "/static/") and the # ".js" extension. - actual_url = staticfiles_storage.url(url_path) + actual_url = staticfiles_storage.url(path_overrides[module]) # RequireJS assumes that every file it tries to load has a ".js" extension, so # we need to remove ".js" from the module path. # RequireJS also already has a base URL set to the base static URL, so we can remove that. path = actual_url.replace('.js', '').replace(django_settings.STATIC_URL, '') - new_paths.append("'{module}': '{path}'".format(module=url_path.replace('.js', ''), path=path)) + new_paths.append("'{module}': '{path}'".format(module=module, path=path)) return html.format(overrides=',\n'.join(new_paths)) diff --git a/common/djangoapps/pipeline_mako/tests/test_render.py b/common/djangoapps/pipeline_mako/tests/test_render.py index c4ab694f51..a7c50d8e19 100644 --- a/common/djangoapps/pipeline_mako/tests/test_render.py +++ b/common/djangoapps/pipeline_mako/tests/test_render.py @@ -7,20 +7,20 @@ from pipeline_mako import render_require_js_path_overrides class RequireJSPathOverridesTest(TestCase): """Test RequireJS path overrides. """ - OVERRIDES = [ - 'js/vendor/jquery.min.js', - 'js/vendor/backbone-min.js', - 'js/vendor/text.js' - ] + OVERRIDES = { + 'jquery': 'js/vendor/jquery.min.js', + 'backbone': 'js/vendor/backbone-min.js', + 'text': 'js/vendor/text.js' + } OVERRIDES_JS = [ "