diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index eb7d690116..b63828eba5 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -196,6 +196,8 @@ def get_course_info_section(request, course, section_key): loc = Location(course.location.tag, course.location.org, course.location.course, 'course_info', section_key) + log.debug("in get_course_info, static_asset_path=%s" % course.lms.static_asset_path) + # Use an empty cache model_data_cache = ModelDataCache([], course.id, request.user) info_module = get_module( @@ -204,7 +206,8 @@ def get_course_info_section(request, course, section_key): loc, model_data_cache, course.id, - wrap_xmodule_display=False + wrap_xmodule_display=False, + static_asset_path=course.lms.static_asset_path ) html = '' diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index ba4654ce9c..981ccde441 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -124,7 +124,8 @@ def toc_for_course(user, request, course, active_chapter, active_section, model_ def get_module(user, request, location, model_data_cache, course_id, position=None, not_found_ok=False, wrap_xmodule_display=True, - grade_bucket_type=None, depth=0): + grade_bucket_type=None, depth=0, + static_asset_path=''): """ Get an instance of the xmodule class identified by location, setting the state based on an existing StudentModule, or creating one if none @@ -141,6 +142,10 @@ def get_module(user, request, location, model_data_cache, course_id, position within module - depth : number of levels of descendents to cache when loading this module. None means cache all descendents + - static_asset_path : static asset path to use (overrides descriptor's value); needed + by get_course_info_section, because info section modules + do not have a course as the parent module, and thus do not + inherit this lms key value. Returns: xmodule instance, or None if the user does not have access to the module. If there's an error, will try to return an instance of ErrorModule @@ -152,7 +157,8 @@ def get_module(user, request, location, model_data_cache, course_id, return get_module_for_descriptor(user, request, descriptor, model_data_cache, course_id, position=position, wrap_xmodule_display=wrap_xmodule_display, - grade_bucket_type=grade_bucket_type) + grade_bucket_type=grade_bucket_type, + static_asset_path=static_asset_path) except ItemNotFoundError: if not not_found_ok: log.exception("Error in get_module") @@ -179,7 +185,8 @@ def get_xqueue_callback_url_prefix(request): def get_module_for_descriptor(user, request, descriptor, model_data_cache, course_id, - position=None, wrap_xmodule_display=True, grade_bucket_type=None): + position=None, wrap_xmodule_display=True, grade_bucket_type=None, + static_asset_path=''): """ Implements get_module, extracting out the request-specific functionality. @@ -194,12 +201,14 @@ def get_module_for_descriptor(user, request, descriptor, model_data_cache, cours return get_module_for_descriptor_internal(user, descriptor, model_data_cache, course_id, track_function, xqueue_callback_url_prefix, - position, wrap_xmodule_display, grade_bucket_type) + position, wrap_xmodule_display, grade_bucket_type, + static_asset_path) def get_module_for_descriptor_internal(user, descriptor, model_data_cache, course_id, track_function, xqueue_callback_url_prefix, - position=None, wrap_xmodule_display=True, grade_bucket_type=None): + position=None, wrap_xmodule_display=True, grade_bucket_type=None, + static_asset_path=''): """ Actually implement get_module, without requiring a request. @@ -282,7 +291,8 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours # inner_get_module, not the parent's callback. Add it as an argument.... return get_module_for_descriptor_internal(user, descriptor, model_data_cache, course_id, track_function, make_xqueue_callback, - position, wrap_xmodule_display, grade_bucket_type) + position, wrap_xmodule_display, grade_bucket_type, + static_asset_path) def xblock_model_data(descriptor): return DbModel( @@ -349,7 +359,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours static_replace.replace_static_urls, data_directory=getattr(descriptor, 'data_dir', None), course_id=course_id, - static_asset_path=descriptor.lms.static_asset_path, + static_asset_path=static_asset_path or descriptor.lms.static_asset_path, ), replace_course_urls=partial( static_replace.replace_course_urls, @@ -409,7 +419,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours _get_html, getattr(descriptor, 'data_dir', None), course_id=course_id, - static_asset_path=descriptor.lms.static_asset_path + static_asset_path=static_asset_path or descriptor.lms.static_asset_path ) # Allow URLs of the form '/course/' refer to the root of multicourse directory