xlint.py 940 Bytes
Newer Older
David Baumgold committed
1 2 3
"""
Verify the structure of courseware as to it's suitability for import
"""
4
from django.core.management.base import BaseCommand, CommandError
5
from xmodule.modulestore.xml_importer import perform_xlint
6 7 8


class Command(BaseCommand):
David Baumgold committed
9 10
    """Verify the structure of courseware as to it's suitability for import"""
    help = "Verify the structure of courseware as to it's suitability for import"
11

12
    def handle(self, *args, **options):
David Baumgold committed
13
        "Execute the command"
14 15 16 17 18 19 20 21
        if len(args) == 0:
            raise CommandError("import requires at least one argument: <data directory> [<course dir>...]")

        data_dir = args[0]
        if len(args) > 1:
            course_dirs = args[1:]
        else:
            course_dirs = None
David Baumgold committed
22
        print("Importing.  Data_dir={data}, course_dirs={courses}".format(
23
            data=data_dir,
David Baumgold committed
24
            courses=course_dirs))
25
        perform_xlint(data_dir, course_dirs, load_error_modules=False)