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
ea068d4a
Commit
ea068d4a
authored
Feb 14, 2013
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add exporting of policy.json
parent
27e8d699
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
cms/djangoapps/contentstore/tests/test_contentstore.py
+11
-2
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+9
-2
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
ea068d4a
...
@@ -212,12 +212,21 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
...
@@ -212,12 +212,21 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
fs
=
OSFS
(
root_dir
/
'test_export/policies/6.002_Spring_2012'
)
fs
=
OSFS
(
root_dir
/
'test_export/policies/6.002_Spring_2012'
)
self
.
assertTrue
(
fs
.
exists
(
'grading_policy.json'
))
self
.
assertTrue
(
fs
.
exists
(
'grading_policy.json'
))
course
=
ms
.
get_item
(
location
)
# compare what's on disk compared to what we have in our course
# compare what's on disk compared to what we have in our course
with
fs
.
open
(
'grading_policy.json'
,
'r'
)
as
grading_policy
:
with
fs
.
open
(
'grading_policy.json'
,
'r'
)
as
grading_policy
:
on_disk
=
loads
(
grading_policy
.
read
())
on_disk
=
loads
(
grading_policy
.
read
())
course
=
ms
.
get_item
(
location
)
self
.
assertEqual
(
on_disk
,
course
.
definition
[
'data'
][
'grading_policy'
])
self
.
assertEqual
(
on_disk
,
course
.
definition
[
'data'
][
'grading_policy'
])
#check for policy.json
self
.
assertTrue
(
fs
.
exists
(
'policy.json'
))
# compare what's on disk to what we have in the course module
with
fs
.
open
(
'policy.json'
,
'r'
)
as
course_policy
:
on_disk
=
loads
(
course_policy
.
read
())
self
.
assertIn
(
'course/6.002_Spring_2012'
,
on_disk
)
self
.
assertEqual
(
on_disk
[
'course/6.002_Spring_2012'
],
course
.
metadata
)
# remove old course
# remove old course
delete_course
(
ms
,
cs
,
location
)
delete_course
(
ms
,
cs
,
location
)
...
...
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
View file @
ea068d4a
...
@@ -31,8 +31,15 @@ def export_to_xml(modulestore, contentstore, course_location, root_dir, course_d
...
@@ -31,8 +31,15 @@ def export_to_xml(modulestore, contentstore, course_location, root_dir, course_d
# export the grading policy
# export the grading policy
policies_dir
=
export_fs
.
makeopendir
(
'policies'
)
policies_dir
=
export_fs
.
makeopendir
(
'policies'
)
course_run_policy_dir
=
policies_dir
.
makeopendir
(
course
.
location
.
name
)
course_run_policy_dir
=
policies_dir
.
makeopendir
(
course
.
location
.
name
)
with
course_run_policy_dir
.
open
(
'grading_policy.json'
,
'w'
)
as
grading_policy
:
if
'grading_policy'
in
course
.
definition
[
'data'
]:
grading_policy
.
write
(
dumps
(
course
.
definition
[
'data'
][
'grading_policy'
]))
with
course_run_policy_dir
.
open
(
'grading_policy.json'
,
'w'
)
as
grading_policy
:
grading_policy
.
write
(
dumps
(
course
.
definition
[
'data'
][
'grading_policy'
]))
# export all of the course metadata in policy.json
with
course_run_policy_dir
.
open
(
'policy.json'
,
'w'
)
as
course_policy
:
policy
=
{}
policy
=
{
'course/'
+
course
.
location
.
name
:
course
.
metadata
}
course_policy
.
write
(
dumps
(
policy
))
def
export_extra_content
(
export_fs
,
modulestore
,
course_location
,
category_type
,
dirname
,
file_suffix
=
''
):
def
export_extra_content
(
export_fs
,
modulestore
,
course_location
,
category_type
,
dirname
,
file_suffix
=
''
):
...
...
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