Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
210fa112
Commit
210fa112
authored
Aug 20, 2013
by
ichuang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify handling of info/handouts and module_render to honor static_asset_path
parent
e9ef4507
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
+22
-9
lms/djangoapps/courseware/courses.py
+4
-1
lms/djangoapps/courseware/module_render.py
+18
-8
No files found.
lms/djangoapps/courseware/courses.py
View file @
210fa112
...
@@ -196,6 +196,8 @@ def get_course_info_section(request, course, section_key):
...
@@ -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
)
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
# Use an empty cache
model_data_cache
=
ModelDataCache
([],
course
.
id
,
request
.
user
)
model_data_cache
=
ModelDataCache
([],
course
.
id
,
request
.
user
)
info_module
=
get_module
(
info_module
=
get_module
(
...
@@ -204,7 +206,8 @@ def get_course_info_section(request, course, section_key):
...
@@ -204,7 +206,8 @@ def get_course_info_section(request, course, section_key):
loc
,
loc
,
model_data_cache
,
model_data_cache
,
course
.
id
,
course
.
id
,
wrap_xmodule_display
=
False
wrap_xmodule_display
=
False
,
static_asset_path
=
course
.
lms
.
static_asset_path
)
)
html
=
''
html
=
''
...
...
lms/djangoapps/courseware/module_render.py
View file @
210fa112
...
@@ -124,7 +124,8 @@ def toc_for_course(user, request, course, active_chapter, active_section, model_
...
@@ -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
,
def
get_module
(
user
,
request
,
location
,
model_data_cache
,
course_id
,
position
=
None
,
not_found_ok
=
False
,
wrap_xmodule_display
=
True
,
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,
Get an instance of the xmodule class identified by location,
setting the state based on an existing StudentModule, or creating one if none
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,
...
@@ -141,6 +142,10 @@ def get_module(user, request, location, model_data_cache, course_id,
position within module
position within module
- depth : number of levels of descendents to cache when loading this module.
- depth : number of levels of descendents to cache when loading this module.
None means cache all descendents
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
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
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,
...
@@ -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
,
return
get_module_for_descriptor
(
user
,
request
,
descriptor
,
model_data_cache
,
course_id
,
position
=
position
,
position
=
position
,
wrap_xmodule_display
=
wrap_xmodule_display
,
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
:
except
ItemNotFoundError
:
if
not
not_found_ok
:
if
not
not_found_ok
:
log
.
exception
(
"Error in get_module"
)
log
.
exception
(
"Error in get_module"
)
...
@@ -179,7 +185,8 @@ def get_xqueue_callback_url_prefix(request):
...
@@ -179,7 +185,8 @@ def get_xqueue_callback_url_prefix(request):
def
get_module_for_descriptor
(
user
,
request
,
descriptor
,
model_data_cache
,
course_id
,
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.
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
...
@@ -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
,
return
get_module_for_descriptor_internal
(
user
,
descriptor
,
model_data_cache
,
course_id
,
track_function
,
xqueue_callback_url_prefix
,
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
,
def
get_module_for_descriptor_internal
(
user
,
descriptor
,
model_data_cache
,
course_id
,
track_function
,
xqueue_callback_url_prefix
,
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.
Actually implement get_module, without requiring a request.
...
@@ -282,7 +291,8 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours
...
@@ -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....
# 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
,
return
get_module_for_descriptor_internal
(
user
,
descriptor
,
model_data_cache
,
course_id
,
track_function
,
make_xqueue_callback
,
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
):
def
xblock_model_data
(
descriptor
):
return
DbModel
(
return
DbModel
(
...
@@ -349,7 +359,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours
...
@@ -349,7 +359,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours
static_replace
.
replace_static_urls
,
static_replace
.
replace_static_urls
,
data_directory
=
getattr
(
descriptor
,
'data_dir'
,
None
),
data_directory
=
getattr
(
descriptor
,
'data_dir'
,
None
),
course_id
=
course_id
,
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
(
replace_course_urls
=
partial
(
static_replace
.
replace_course_urls
,
static_replace
.
replace_course_urls
,
...
@@ -409,7 +419,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours
...
@@ -409,7 +419,7 @@ def get_module_for_descriptor_internal(user, descriptor, model_data_cache, cours
_get_html
,
_get_html
,
getattr
(
descriptor
,
'data_dir'
,
None
),
getattr
(
descriptor
,
'data_dir'
,
None
),
course_id
=
course_id
,
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
# Allow URLs of the form '/course/' refer to the root of multicourse directory
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment