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
20e4d585
Commit
20e4d585
authored
Sep 24, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation and comments.
parent
8e7fc153
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
common/lib/xmodule/xmodule/contentstore/mongo.py
+11
-2
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+2
-0
No files found.
common/lib/xmodule/xmodule/contentstore/mongo.py
View file @
20e4d585
...
...
@@ -104,7 +104,16 @@ class MongoContentStore(ContentStore):
with
disk_fs
.
open
(
content
.
name
,
'wb'
)
as
asset_file
:
asset_file
.
write
(
content
.
data
)
def
export_all_for_course
(
self
,
course_location
,
output_directory
,
policy_file
):
def
export_all_for_course
(
self
,
course_location
,
output_directory
,
assets_policy_file
):
"""
Export all of this course's assets to the output_directory. Export all of the assets'
attributes to the policy file.
:param course_location: the Location of type 'course'
:param output_directory: the directory under which to put all the asset files
:param assets_policy_file: the filename for the policy file which should be in the same
directory as the other policy files.
"""
policy
=
{}
assets
=
self
.
get_all_content_for_course
(
course_location
)
...
...
@@ -115,7 +124,7 @@ class MongoContentStore(ContentStore):
if
attr
not
in
[
'_id'
,
'md5'
,
'uploadDate'
,
'length'
,
'chunkSize'
]:
policy
.
setdefault
(
asset_location
.
url
(),
{})[
attr
]
=
value
with
open
(
policy_file
,
'w'
)
as
f
:
with
open
(
assets_
policy_file
,
'w'
)
as
f
:
json
.
dump
(
policy
,
f
)
def
get_all_content_thumbnails_for_course
(
self
,
location
):
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
20e4d585
...
...
@@ -27,6 +27,8 @@ def import_static_content(modules, course_loc, course_data_path, static_content_
with
open
(
course_data_path
/
'policies/assets.json'
)
as
f
:
policy
=
json
.
load
(
f
)
except
(
IOError
,
ValueError
)
as
err
:
# xml backed courses won't have this file, only exported courses; so, its absence is not
# really an exception.
policy
=
{}
verbose
=
True
...
...
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