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
5ebab982
Commit
5ebab982
authored
Dec 05, 2014
by
Adam Palay
Committed by
Zia Fazal
Apr 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix export for openassessment drafts (PLAT-249)
parent
14553949
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
cms/djangoapps/contentstore/tests/test_contentstore.py
+35
-0
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
+4
-0
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
5ebab982
...
...
@@ -464,6 +464,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
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/xml_exporter.py
View file @
5ebab982
...
...
@@ -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
)
...
...
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