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
OpenEdx
edx-platform
Commits
e223d753
Commit
e223d753
authored
Jul 24, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #489 from edx/dhm/export_policy
change of defaults for rerandomize/showanswer
parents
dd338c17
400ff494
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
common/lib/xmodule/xmodule/capa_module.py
+0
-14
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+22
-0
No files found.
common/lib/xmodule/xmodule/capa_module.py
View file @
e223d753
...
@@ -1159,20 +1159,6 @@ class CapaDescriptor(CapaFields, RawDescriptor):
...
@@ -1159,20 +1159,6 @@ class CapaDescriptor(CapaFields, RawDescriptor):
path
[
8
:],
path
[
8
:],
]
]
@classmethod
def
from_xml
(
cls
,
xml_data
,
system
,
org
=
None
,
course
=
None
):
"""
Augment regular translation w/ setting the pre-Studio defaults.
"""
problem
=
super
(
CapaDescriptor
,
cls
)
.
from_xml
(
xml_data
,
system
,
org
,
course
)
course_policy
=
system
.
policy
.
setdefault
(
'course/{}'
.
format
(
system
.
url_name
),
{})
# pylint: disable=W0212
if
'showanswer'
not
in
problem
.
_model_data
and
'showanswer'
not
in
course_policy
:
problem
.
showanswer
=
"closed"
if
'rerandomize'
not
in
problem
.
_model_data
and
'rerandomize'
not
in
course_policy
:
problem
.
rerandomize
=
"always"
return
problem
@property
@property
def
non_editable_metadata_fields
(
self
):
def
non_editable_metadata_fields
(
self
):
non_editable_fields
=
super
(
CapaDescriptor
,
self
)
.
non_editable_metadata_fields
non_editable_fields
=
super
(
CapaDescriptor
,
self
)
.
non_editable_metadata_fields
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
e223d753
...
@@ -523,6 +523,26 @@ def validate_data_source_paths(data_dir, course_dir):
...
@@ -523,6 +523,26 @@ def validate_data_source_paths(data_dir, course_dir):
return
err_cnt
,
warn_cnt
return
err_cnt
,
warn_cnt
def
validate_course_policy
(
module_store
,
course_id
):
"""
Validate that the course explicitly sets values for any fields whose defaults may have changed between
the export and the import.
Does not add to error count as these are just warnings.
"""
# is there a reliable way to get the module location just given the course_id?
warn_cnt
=
0
for
module
in
module_store
.
modules
[
course_id
]
.
itervalues
():
if
module
.
location
.
category
==
'course'
:
if
not
'rerandomize'
in
module
.
_model_data
:
warn_cnt
+=
1
print
'WARN: course policy does not specify value for "rerandomize" whose default is now "never". The behavior of your course may change.'
if
not
'showanswer'
in
module
.
_model_data
:
warn_cnt
+=
1
print
'WARN: course policy does not specify value for "showanswer" whose default is now "finished". The behavior of your course may change.'
return
warn_cnt
def
perform_xlint
(
data_dir
,
course_dirs
,
def
perform_xlint
(
data_dir
,
course_dirs
,
default_class
=
'xmodule.raw_module.RawDescriptor'
,
default_class
=
'xmodule.raw_module.RawDescriptor'
,
load_error_modules
=
True
):
load_error_modules
=
True
):
...
@@ -568,6 +588,8 @@ def perform_xlint(data_dir, course_dirs,
...
@@ -568,6 +588,8 @@ def perform_xlint(data_dir, course_dirs,
err_cnt
+=
validate_category_hierarchy
(
module_store
,
course_id
,
"chapter"
,
"sequential"
)
err_cnt
+=
validate_category_hierarchy
(
module_store
,
course_id
,
"chapter"
,
"sequential"
)
# constrain that sequentials only have 'verticals'
# constrain that sequentials only have 'verticals'
err_cnt
+=
validate_category_hierarchy
(
module_store
,
course_id
,
"sequential"
,
"vertical"
)
err_cnt
+=
validate_category_hierarchy
(
module_store
,
course_id
,
"sequential"
,
"vertical"
)
# validate the course policy overrides any defaults which have changed over time
warn_cnt
+=
validate_course_policy
(
module_store
,
course_id
)
# don't allow metadata on verticals, since we can't edit them in studio
# don't allow metadata on verticals, since we can't edit them in studio
err_cnt
+=
validate_no_non_editable_metadata
(
module_store
,
course_id
,
"vertical"
)
err_cnt
+=
validate_no_non_editable_metadata
(
module_store
,
course_id
,
"vertical"
)
# don't allow metadata on chapters, since we can't edit them in studio
# don't allow metadata on chapters, since we can't edit them in studio
...
...
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