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
84992cdf
Commit
84992cdf
authored
Aug 01, 2014
by
Nimisha Asthagiri
Committed by
Don Mitchell
Aug 08, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor xml_importer.py for easier reading.
Remove post-publish step.
parent
47851c50
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
26 deletions
+26
-26
cms/djangoapps/contentstore/management/commands/import.py
+1
-1
cms/djangoapps/contentstore/tests/test_contentstore.py
+15
-15
cms/djangoapps/contentstore/tests/test_import.py
+5
-5
cms/djangoapps/contentstore/tests/test_import_draft_order.py
+1
-1
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
+1
-1
cms/djangoapps/contentstore/views/import_export.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_assets.py
+2
-2
common/lib/xmodule/xmodule/modulestore/xml_importer.py
+0
-0
No files found.
cms/djangoapps/contentstore/management/commands/import.py
View file @
84992cdf
...
...
@@ -40,7 +40,7 @@ class Command(BaseCommand):
dis
=
do_import_static
))
mstore
=
modulestore
()
_
,
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
mstore
,
ModuleStoreEnum
.
UserID
.
mgmt_command
,
data_dir
,
course_dirs
,
load_error_modules
=
False
,
static_content_store
=
contentstore
(),
verbose
=
True
,
do_import_static
=
do_import_static
,
...
...
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
84992cdf
...
...
@@ -89,7 +89,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
component_types should cause 'Video' to be present.
"""
store
=
self
.
store
_
,
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course
=
course_items
[
0
]
course
.
advanced_modules
=
component_types
store
.
update_item
(
course
,
self
.
user
.
id
)
...
...
@@ -116,7 +116,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
def
test_malformed_edit_unit_request
(
self
):
store
=
self
.
store
_
,
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
# just pick one vertical
usage_key
=
course_items
[
0
]
.
id
.
make_usage_key
(
'vertical'
,
None
)
...
...
@@ -126,7 +126,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
def
check_edit_unit
(
self
,
test_course_name
):
"""Verifies the editing HTML in all the verticals in the given test course"""
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
test_course_name
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
test_course_name
])
items
=
self
.
store
.
get_items
(
course_items
[
0
]
.
id
,
qualifiers
=
{
'category'
:
'vertical'
})
self
.
_check_verticals
(
items
)
...
...
@@ -148,7 +148,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
both draft and non-draft copies.
'''
store
=
self
.
store
_
,
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_key
=
course_items
[
0
]
.
id
html_usage_key
=
course_key
.
make_usage_key
(
'html'
,
'test_html'
)
...
...
@@ -263,7 +263,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
self
.
assertEqual
(
num_drafts
,
1
)
def
test_no_static_link_rewrites_on_import
(
self
):
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course
=
course_items
[
0
]
handouts_usage_key
=
course
.
id
.
make_usage_key
(
'course_info'
,
'handouts'
)
...
...
@@ -287,7 +287,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
self
.
assertGreater
(
len
(
course
.
textbooks
),
0
)
def
test_import_polls
(
self
):
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_key
=
course_items
[
0
]
.
id
items
=
self
.
store
.
get_items
(
course_key
,
qualifiers
=
{
'category'
:
'poll_question'
})
...
...
@@ -307,7 +307,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
Tests the ajax callback to render an XModule
"""
direct_store
=
self
.
store
_
,
course_items
=
import_from_xml
(
direct_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
direct_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
usage_key
=
course_items
[
0
]
.
id
.
make_usage_key
(
'vertical'
,
'vertical_test'
)
# also try a custom response which will trigger the 'is this course in whitelist' logic
resp
=
self
.
client
.
get_json
(
...
...
@@ -357,7 +357,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
This test case verifies that a course can use specialized override for about data, e.g. /about/Fall_2012/effort.html
while there is a base definition in /about/effort.html
'''
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_key
=
course_items
[
0
]
.
id
effort
=
self
.
store
.
get_item
(
course_key
.
make_usage_key
(
'about'
,
'effort'
))
self
.
assertEqual
(
effort
.
data
,
'6 hours'
)
...
...
@@ -460,7 +460,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
content_store
=
contentstore
()
trash_store
=
contentstore
(
'trashcan'
)
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
)
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
)
# look up original (and thumbnail) in content store, should be there after import
location
=
AssetLocation
.
from_deprecated_string
(
'/c4x/edX/toy/asset/sample_static.txt'
)
...
...
@@ -618,7 +618,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
"""
content_store
=
contentstore
()
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
)
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
)
course_id
=
course_items
[
0
]
.
id
...
...
@@ -845,7 +845,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
def
test_course_handouts_rewrites
(
self
):
# import a test course
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_id
=
course_items
[
0
]
.
id
handouts_location
=
course_id
.
make_usage_key
(
'course_info'
,
'handouts'
)
...
...
@@ -895,7 +895,7 @@ class ContentStoreToyCourseTest(ContentStoreTestCase):
# Create toy course
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_id
=
course_items
[
0
]
.
id
root_dir
=
path
(
mkdtemp_clean
())
...
...
@@ -1271,7 +1271,7 @@ class ContentStoreTest(ContentStoreTestCase):
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_key
=
course_items
[
0
]
.
id
resp
=
self
.
_show_course_overview
(
course_key
)
...
...
@@ -1400,7 +1400,7 @@ class ContentStoreTest(ContentStoreTestCase):
self
.
assertNotEquals
(
new_discussion_item
.
discussion_id
,
'$$GUID$$'
)
def
test_metadata_inheritance
(
self
):
_
,
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course
=
course_items
[
0
]
verticals
=
self
.
store
.
get_items
(
course
.
id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
...
@@ -1466,7 +1466,7 @@ class ContentStoreTest(ContentStoreTestCase):
content_store
=
contentstore
()
# Use conditional_and_poll, as it's got an image already
__
,
courses
=
import_from_xml
(
courses
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
...
...
cms/djangoapps/contentstore/tests/test_import.py
View file @
84992cdf
...
...
@@ -64,7 +64,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
# edx/course can be imported into a namespace with an org/course
# like edx/course_name
module_store
,
__
,
course
=
self
.
load_test_import_course
()
__
,
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data'
,
...
...
@@ -139,7 +139,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
def
test_no_static_link_rewrites_on_import
(
self
):
module_store
=
modulestore
()
_
,
courses
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
do_import_static
=
False
,
verbose
=
True
)
courses
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
do_import_static
=
False
,
verbose
=
True
)
course_key
=
courses
[
0
]
.
id
handouts
=
module_store
.
get_item
(
course_key
.
make_usage_key
(
'course_info'
,
'handouts'
))
...
...
@@ -157,10 +157,10 @@ class ContentStoreImportTest(ModuleStoreTestCase):
store
=
modulestore
()
.
_get_modulestore_by_type
(
ModuleStoreEnum
.
Type
.
mongo
)
# we try to refresh the inheritance tree for each update_item in the import
with
check_exact_number_of_calls
(
store
,
store
.
refresh_cached_metadata_inheritance_tree
,
46
):
with
check_exact_number_of_calls
(
store
,
store
.
refresh_cached_metadata_inheritance_tree
,
28
):
#
the post-publish step loads each item in the subtree, which calls _get_cached_metadata_inheritance_tre
e
with
check_exact_number_of_calls
(
store
,
store
.
_get_cached_metadata_inheritance_tree
,
22
):
#
_get_cached_metadata_inheritance_tree should be called only onc
e
with
check_exact_number_of_calls
(
store
,
store
.
_get_cached_metadata_inheritance_tree
,
1
):
# with bulk-edit in progress, the inheritance tree should be recomputed only at the end of the import
# NOTE: On Jenkins, with memcache enabled, the number of calls here is only 1.
...
...
cms/djangoapps/contentstore/tests/test_import_draft_order.py
View file @
84992cdf
...
...
@@ -10,7 +10,7 @@ class DraftReorderTestCase(ModuleStoreTestCase):
def
test_order
(
self
):
store
=
modulestore
()
_
,
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'import_draft_order'
])
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'import_draft_order'
])
course_key
=
course_items
[
0
]
.
id
sequential
=
store
.
get_item
(
course_key
.
make_usage_key
(
'sequential'
,
'0f4f7649b10141b0bdc9922dcf94515a'
))
verticals
=
sequential
.
children
...
...
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
View file @
84992cdf
...
...
@@ -58,7 +58,7 @@ class XBlockImportTest(ModuleStoreTestCase):
the expected field value set.
"""
_
,
courses
=
import_from_xml
(
courses
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data'
,
[
course_dir
]
)
...
...
cms/djangoapps/contentstore/views/import_export.py
View file @
84992cdf
...
...
@@ -214,7 +214,7 @@ def import_handler(request, course_key_string):
logging
.
debug
(
'found course.xml at {0}'
.
format
(
dirpath
))
_module_store
,
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
modulestore
(),
request
.
user
.
id
,
settings
.
GITHUB_REPO_ROOT
,
...
...
cms/djangoapps/contentstore/views/tests/test_assets.py
View file @
84992cdf
...
...
@@ -49,7 +49,7 @@ class BasicAssetsTestCase(AssetsTestCase):
def
test_pdf_asset
(
self
):
module_store
=
modulestore
()
_
,
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
...
...
@@ -193,7 +193,7 @@ class LockAssetTestCase(AssetsTestCase):
# Load the toy course.
module_store
=
modulestore
()
_
,
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
...
...
common/lib/xmodule/xmodule/modulestore/xml_importer.py
View file @
84992cdf
This diff is collapsed.
Click to expand it.
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