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
1a89c14b
Commit
1a89c14b
authored
Dec 07, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1087 from MITx/fix/cdodge/lms-runtime-bugs
Fix/cdodge/lms runtime bugs
parents
2d866418
2aceb2e4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
13 deletions
+19
-13
common/djangoapps/static_replace.py
+1
-0
common/lib/xmodule/xmodule/capa_module.py
+2
-2
common/lib/xmodule/xmodule/modulestore/xml.py
+2
-0
common/lib/xmodule/xmodule/template_module.py
+2
-2
lms/djangoapps/courseware/courses.py
+3
-5
lms/djangoapps/courseware/module_render.py
+9
-4
No files found.
common/djangoapps/static_replace.py
View file @
1a89c14b
...
...
@@ -60,6 +60,7 @@ def replace(static_url, prefix=None, course_namespace=None):
def
replace_urls
(
text
,
staticfiles_prefix
=
None
,
replace_prefix
=
'/static/'
,
course_namespace
=
None
):
def
replace_url
(
static_url
):
return
replace
(
static_url
,
staticfiles_prefix
,
course_namespace
=
course_namespace
)
...
...
common/lib/xmodule/xmodule/capa_module.py
View file @
1a89c14b
...
...
@@ -347,7 +347,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'
])
return
self
.
system
.
replace_urls
(
html
,
self
.
metadata
[
'data_dir'
]
,
course_namespace
=
self
.
location
)
def
handle_ajax
(
self
,
dispatch
,
get
):
'''
...
...
@@ -451,7 +451,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'
])}
new_answer
=
{
answer_id
:
self
.
system
.
replace_urls
(
answers
[
answer_id
],
self
.
metadata
[
'data_dir'
]
,
course_namespace
=
self
.
location
)}
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
]}
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
1a89c14b
...
...
@@ -53,6 +53,8 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
self
.
unnamed
=
defaultdict
(
int
)
# category -> num of new url_names for that category
self
.
used_names
=
defaultdict
(
set
)
# category -> set of used url_names
self
.
org
,
self
.
course
,
self
.
url_name
=
course_id
.
split
(
'/'
)
# cdodge: adding the course_id as passed in for later reference rather than having to recomine the org/course/url_name
self
.
course_id
=
course_id
self
.
load_error_modules
=
load_error_modules
def
process_xml
(
xml
):
...
...
common/lib/xmodule/xmodule/template_module.py
View file @
1a89c14b
...
...
@@ -3,7 +3,7 @@ from xmodule.raw_module import RawDescriptor
from
lxml
import
etree
from
mako.template
import
Template
from
xmodule.modulestore.django
import
modulestore
import
logging
class
CustomTagModule
(
XModule
):
"""
...
...
@@ -61,7 +61,7 @@ class CustomTagDescriptor(RawDescriptor):
# cdodge: look up the template as a module
template_loc
=
self
.
location
.
_replace
(
category
=
'custom_tag_template'
,
name
=
template_name
)
template_module
=
modulestore
()
.
get_i
tem
(
template_loc
)
template_module
=
modulestore
()
.
get_i
nstance
(
system
.
course_id
,
template_loc
)
template_module_data
=
template_module
.
definition
[
'data'
]
template
=
Template
(
template_module_data
)
return
template
.
render
(
**
params
)
...
...
lms/djangoapps/courseware/courses.py
View file @
1a89c14b
...
...
@@ -148,7 +148,7 @@ def get_course_about_section(course, section_key):
request
=
get_request_for_thread
()
loc
=
course
.
location
.
_replace
(
category
=
'about'
,
name
=
section_key
)
course_module
=
get_module
(
request
.
user
,
request
,
loc
,
None
,
course
.
id
,
not_found_ok
=
True
)
course_module
=
get_module
(
request
.
user
,
request
,
loc
,
None
,
course
.
id
,
not_found_ok
=
True
,
wrap_xmodule_display
=
False
)
html
=
''
...
...
@@ -186,8 +186,7 @@ def get_course_info_section(request, cache, course, section_key):
loc
=
Location
(
course
.
location
.
tag
,
course
.
location
.
org
,
course
.
location
.
course
,
'course_info'
,
section_key
)
course_module
=
get_module
(
request
.
user
,
request
,
loc
,
cache
,
course
.
id
)
course_module
=
get_module
(
request
.
user
,
request
,
loc
,
cache
,
course
.
id
,
wrap_xmodule_display
=
False
)
html
=
''
if
course_module
is
not
None
:
...
...
@@ -196,7 +195,6 @@ def get_course_info_section(request, cache, course, section_key):
return
html
# TODO: Fix this such that these are pulled in as extra course-specific tabs.
# arjun will address this by the end of October if no one does so prior to
# then.
...
...
@@ -222,7 +220,7 @@ def get_course_syllabus_section(course, section_key):
filepath
=
find_file
(
fs
,
dirs
,
section_key
+
".html"
)
with
fs
.
open
(
filepath
)
as
htmlFile
:
return
replace_urls
(
htmlFile
.
read
()
.
decode
(
'utf-8'
),
course
.
metadata
[
'data_dir'
])
course
.
metadata
[
'data_dir'
]
,
course_namespace
=
course
.
location
)
except
ResourceNotFoundError
:
log
.
exception
(
"Missing syllabus section {key} in course {url}"
.
format
(
key
=
section_key
,
url
=
course
.
location
.
url
()))
...
...
lms/djangoapps/courseware/module_render.py
View file @
1a89c14b
...
...
@@ -115,7 +115,7 @@ def toc_for_course(user, request, course, active_chapter, active_section):
return
chapters
def
get_module
(
user
,
request
,
location
,
student_module_cache
,
course_id
,
position
=
None
,
not_found_ok
=
False
):
def
get_module
(
user
,
request
,
location
,
student_module_cache
,
course_id
,
position
=
None
,
not_found_ok
=
False
,
wrap_xmodule_display
=
True
):
"""
Get an instance of the xmodule class identified by location,
setting the state based on an existing StudentModule, or creating one if none
...
...
@@ -136,7 +136,7 @@ def get_module(user, request, location, student_module_cache, course_id, positio
if possible. If not possible, return None.
"""
try
:
return
_get_module
(
user
,
request
,
location
,
student_module_cache
,
course_id
,
position
)
return
_get_module
(
user
,
request
,
location
,
student_module_cache
,
course_id
,
position
,
wrap_xmodule_display
)
except
ItemNotFoundError
:
if
not
not_found_ok
:
log
.
exception
(
"Error in get_module"
)
...
...
@@ -146,7 +146,7 @@ def get_module(user, request, location, student_module_cache, course_id, positio
log
.
exception
(
"Error in get_module"
)
return
None
def
_get_module
(
user
,
request
,
location
,
student_module_cache
,
course_id
,
position
=
None
):
def
_get_module
(
user
,
request
,
location
,
student_module_cache
,
course_id
,
position
=
None
,
wrap_xmodule_display
=
True
):
"""
Actually implement get_module. See docstring there for details.
"""
...
...
@@ -261,8 +261,13 @@ def _get_module(user, request, location, student_module_cache, course_id, positi
# Make an error module
return
err_descriptor
.
xmodule_constructor
(
system
)(
None
,
None
)
_get_html
=
module
.
get_html
if
wrap_xmodule_display
==
True
:
_get_html
=
wrap_xmodule
(
module
.
get_html
,
module
,
'xmodule_display.html'
)
module
.
get_html
=
replace_static_urls
(
wrap_xmodule
(
module
.
get_html
,
module
,
'xmodule_display.html'
)
,
_get_html
,
module
.
metadata
[
'data_dir'
]
if
'data_dir'
in
module
.
metadata
else
''
,
course_namespace
=
module
.
location
.
_replace
(
category
=
None
,
name
=
None
))
...
...
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