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
897d5d29
Commit
897d5d29
authored
Jul 03, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Swallow attempts to create a new item where one already exists
parent
1756f3ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
cms/djangoapps/contentstore/__init__.py
+10
-0
No files found.
cms/djangoapps/contentstore/__init__.py
View file @
897d5d29
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml
import
XMLModuleStore
import
logging
log
=
logging
.
getLogger
(
__name__
)
def
import_from_xml
(
org
,
course
,
data_dir
):
...
...
@@ -9,7 +12,14 @@ def import_from_xml(org, course, data_dir):
"""
module_store
=
XMLModuleStore
(
org
,
course
,
data_dir
,
'xmodule.raw_module.RawDescriptor'
,
eager
=
True
)
for
module
in
module_store
.
modules
.
itervalues
():
# TODO (cpennington): This forces import to overrite the same items.
# This should in the future create new revisions of the items on import
try
:
modulestore
()
.
create_item
(
module
.
location
)
except
:
log
.
exception
(
'Item already exists at
%
s'
%
module
.
location
.
url
())
pass
if
'data'
in
module
.
definition
:
modulestore
()
.
update_item
(
module
.
location
,
module
.
definition
[
'data'
])
if
'children'
in
module
.
definition
:
...
...
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