diff --git a/cms/djangoapps/contentstore/management/commands/xlint.py b/cms/djangoapps/contentstore/management/commands/xlint.py index e8f7b248e4..6bc254a1ff 100644 --- a/cms/djangoapps/contentstore/management/commands/xlint.py +++ b/cms/djangoapps/contentstore/management/commands/xlint.py @@ -1,5 +1,5 @@ from django.core.management.base import BaseCommand, CommandError -from xmodule.modulestore.xml_importer import import_from_xml +from xmodule.modulestore.xml_importer import perform_xlint from xmodule.modulestore.django import modulestore from xmodule.contentstore.django import contentstore @@ -25,4 +25,4 @@ class Command(BaseCommand): print "Importing. Data_dir={data}, course_dirs={courses}".format( data=data_dir, courses=course_dirs) - import_from_xml(None, data_dir, course_dirs, load_error_modules=False, validate_only=True) + perform_xlint(data_dir, course_dirs, load_error_modules=False) diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index c6764b491c..3f44b5d2c6 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -88,7 +88,7 @@ def verify_content_links(module, base_dir, static_content_store, link, remap_dic def import_from_xml(store, data_dir, course_dirs=None, default_class='xmodule.raw_module.RawDescriptor', - load_error_modules=True, static_content_store=None, target_location_namespace=None, validate_only=False): + load_error_modules=True, static_content_store=None, target_location_namespace=None): """ Import the specified xml data_dir into the "store" modulestore, using org and course as the location org and course. @@ -110,10 +110,6 @@ def import_from_xml(store, data_dir, course_dirs=None, load_error_modules=load_error_modules ) - if validate_only: - perform_xlint(data_dir, course_dirs, module_store) - return module_store, [] - # NOTE: the XmlModuleStore does not implement get_items() which would be a preferable means # to enumerate the entire collection of course modules. It will be left as a TBD to implement that # method on XmlModuleStore. @@ -243,10 +239,19 @@ def validate_data_source_paths(data_dir, course_dir): return err_cnt, warn_cnt -def perform_xlint(data_dir, course_dirs,module_store): +def perform_xlint(data_dir, course_dirs, + default_class='xmodule.raw_module.RawDescriptor', + load_error_modules=True): err_cnt = 0 warn_cnt = 0 + module_store = XMLModuleStore( + data_dir, + default_class=default_class, + course_dirs=course_dirs, + load_error_modules=load_error_modules + ) + # check all data source path information for course_dir in course_dirs: _err_cnt, _warn_cnt = validate_data_source_paths(path(data_dir), course_dir)