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
82abdd07
Commit
82abdd07
authored
Oct 11, 2012
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
respond to some of Cale's comments
parent
bf392e36
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+10
-4
No files found.
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
82abdd07
...
...
@@ -27,9 +27,8 @@ def import_static_content(modules, data_dir, static_content_store):
if
course_data_dir
is
None
or
course_loc
is
None
:
return
remap_dict
'''
now import all static assets
'''
# now import all static assets
static_dir
=
'{0}/{1}/static/'
.
format
(
data_dir
,
course_data_dir
)
for
dirname
,
dirnames
,
filenames
in
os
.
walk
(
static_dir
):
...
...
@@ -85,8 +84,10 @@ def import_from_xml(store, data_dir, course_dirs=None,
load_error_modules
=
load_error_modules
,
)
# NOTE: the XmlModuleStore does not implement get_items() which would be a preferable means
# to enumerate the entire collection of course modules. It will be left as a TBD to implement that
# method on XmlModuleStore.
for
course_id
in
module_store
.
modules
.
keys
():
remap_dict
=
{}
if
static_content_store
is
not
None
:
remap_dict
=
import_static_content
(
module_store
.
modules
[
course_id
],
data_dir
,
static_content_store
)
...
...
@@ -103,9 +104,14 @@ def import_from_xml(store, data_dir, course_dirs=None,
# cdodge: update any references to the static content paths
# This is a bit brute force - simple search/replace - but it's unlikely that such references to '/static/....'
# would occur naturally (in the wild)
# @TODO, sorry a bit of technical debt here. There are some helper methods in xmodule_modifiers.py and static_replace.py which could
# better do the url replace on the html rendering side rather than on the ingest side
try
:
if
'/static/'
in
module_data
:
for
subkey
in
remap_dict
.
keys
():
module_data
=
module_data
.
replace
(
'/static/'
+
subkey
,
'xasset:'
+
remap_dict
[
subkey
])
except
:
pass
# part of the techincal debt is that module_data might not be a string (e.g. ABTest)
store
.
update_item
(
module
.
location
,
module_data
)
...
...
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