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
95f2c9e2
Commit
95f2c9e2
authored
Jan 29, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standardize how static urls are replaced by modules in their own html
parent
89f984c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
common/lib/xmodule/xmodule/capa_module.py
+2
-2
lms/djangoapps/courseware/module_render.py
+6
-2
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
95f2c9e2
...
...
@@ -355,7 +355,7 @@ class CapaModule(XModule):
id
=
self
.
location
.
html_id
(),
ajax_url
=
self
.
system
.
ajax_url
)
+
html
+
"</div>"
# now do the substitutions which are filesystem based, e.g. '/static/' prefixes
return
self
.
system
.
replace_urls
(
html
,
self
.
metadata
[
'data_dir'
],
course_namespace
=
self
.
location
)
return
self
.
system
.
replace_urls
(
html
)
def
handle_ajax
(
self
,
dispatch
,
get
):
'''
...
...
@@ -460,7 +460,7 @@ class CapaModule(XModule):
new_answers
=
dict
()
for
answer_id
in
answers
:
try
:
new_answer
=
{
answer_id
:
self
.
system
.
replace_urls
(
answers
[
answer_id
]
,
self
.
metadata
[
'data_dir'
],
course_namespace
=
self
.
location
)}
new_answer
=
{
answer_id
:
self
.
system
.
replace_urls
(
answers
[
answer_id
])}
except
TypeError
:
log
.
debug
(
'Unable to perform URL substitution on answers[
%
s]:
%
s'
%
(
answer_id
,
answers
[
answer_id
]))
new_answer
=
{
answer_id
:
answers
[
answer_id
]}
...
...
lms/djangoapps/courseware/module_render.py
View file @
95f2c9e2
...
...
@@ -244,7 +244,11 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
# TODO (cpennington): This should be removed when all html from
# a module is coming through get_html and is therefore covered
# by the replace_static_urls code below
replace_urls
=
replace_urls
,
replace_urls
=
partial
(
replace_urls
,
staticfiles_prefix
=
'/static/'
+
module
.
metadata
.
get
(
'data_dir'
,
''
),
course_namespace
=
module
.
location
.
_replace
(
category
=
None
,
name
=
None
),
),
node_path
=
settings
.
NODE_PATH
,
anonymous_student_id
=
unique_id_for_user
(
user
),
course_id
=
course_id
,
...
...
@@ -280,7 +284,7 @@ def _get_module(user, request, descriptor, student_module_cache, course_id,
module
.
get_html
=
replace_static_urls
(
_get_html
,
'/static/'
+
module
.
metadata
[
'data_dir'
]
if
'data_dir'
in
module
.
metadata
else
''
,
'/static/'
+
module
.
metadata
.
get
(
'data_dir'
,
''
)
,
course_namespace
=
module
.
location
.
_replace
(
category
=
None
,
name
=
None
))
# 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