Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
896b1915
Commit
896b1915
authored
10 years ago
by
Adam
Browse files
Options
Downloads
Plain Diff
Merge pull request #6161 from edx/adam/fix-openended-draft-export
fix export for openassessment drafts (PLAT-249)
parents
f561e79a
bd689789
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cms/djangoapps/contentstore/tests/test_contentstore.py
+35
-0
35 additions, 0 deletions
cms/djangoapps/contentstore/tests/test_contentstore.py
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+4
-0
4 additions, 0 deletions
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
with
39 additions
and
0 deletions
cms/djangoapps/contentstore/tests/test_contentstore.py
+
35
−
0
View file @
896b1915
...
...
@@ -462,6 +462,41 @@ class ImportRequiredTestCases(ContentStoreTestCase):
)
self
.
assertEqual
(
len
(
items
),
1
)
def
test_export_course_no_xml_attributes
(
self
):
"""
Test that a module without an `xml_attributes` attr will still be
exported successfully
"""
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'
toy
'
])
course_id
=
SlashSeparatedCourseKey
(
'
edX
'
,
'
toy
'
,
'
2012_Fall
'
)
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'
category
'
:
'
vertical
'
})
vertical
=
verticals
[
0
]
# create OpenAssessmentBlock:
open_assessment
=
ItemFactory
.
create
(
parent_location
=
vertical
.
location
,
category
=
"
openassessment
"
,
display_name
=
"
untitled
"
,
)
# convert it to draft
draft_open_assessment
=
self
.
store
.
convert_to_draft
(
open_assessment
.
location
,
self
.
user
.
id
)
# note that it has no `xml_attributes` attribute
self
.
assertFalse
(
hasattr
(
draft_open_assessment
,
"
xml_attributes
"
))
# export should still complete successfully
root_dir
=
path
(
mkdtemp_clean
())
export_to_xml
(
self
.
store
,
content_store
,
course_id
,
root_dir
,
'
test_no_xml_attributes
'
)
class
MiscCourseTests
(
ContentStoreTestCase
):
"""
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+
4
−
0
View file @
896b1915
...
...
@@ -149,6 +149,10 @@ def export_to_xml(modulestore, contentstore, course_key, root_dir, course_dir):
# since export_from_xml (called by `add_xml_to_node`)
# exports a whole tree
# ensure module has "xml_attributes" attr
if
not
hasattr
(
draft_node
.
module
,
'
xml_attributes
'
):
draft_node
.
module
.
xml_attributes
=
{}
draft_node
.
module
.
xml_attributes
[
'
parent_url
'
]
=
draft_node
.
parent_url
parent
=
modulestore
.
get_item
(
draft_node
.
parent_location
)
index
=
parent
.
children
.
index
(
draft_node
.
module
.
location
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment