diff --git a/cms/djangoapps/contentstore/__init__.py b/cms/djangoapps/contentstore/__init__.py index 7a38b99b5e..433278c47b 100644 --- a/cms/djangoapps/contentstore/__init__.py +++ b/cms/djangoapps/contentstore/__init__.py @@ -1,5 +1,8 @@ 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(): - modulestore().create_item(module.location) + + # 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: