def handle(self, *args, **options):
        """
        This is where the user input is handled, and the appropriate
        actions are taken.
        """
        #print "OPTIONS", options
        #print "ARGS:", args
        check_for_eve_db()

        try:
            if len(args) == 0:
                print "No table names specified, importing all."
                util.run_importers(util.IMPORT_LIST)
            else:
                specified_importers = get_importer_classes_from_arg_list(args)
                start_at_import = options.get('start_at_import')
                print "Importing: %s" % args

                include_deps = options.get('include_deps')
                if include_deps and not start_at_import:
                    print "Including dependencies."

                if start_at_import:
                    # User wishes to start the import process at a specific
                    # table name. Import the specified importer, and
                    # everything after it.
                    specified_importers = get_importers_for_start_at_import(specified_importers)

                util.run_importers(specified_importers,
                                   include_deps=include_deps)
        except KeyboardInterrupt:
            print "Terminating early..."
            exit_with_succ()
示例#2
0
    def handle(self, *args, **options):
        """
        This is where the user input is handled, and the appropriate
        actions are taken.
        """
        #print "OPTIONS", options
        #print "ARGS:", args

        if len(args) < 1:
            raise CommandError(
                "You must specify the static data dump file to import. This is "
                "probably something in the pattern of *.db3")

        try:
            sqlite_file = args[0]
            check_for_eve_db(sqlite_file)

            database = options.get('database')
            if database:
                print "Using database '%s'" % database

            if len(args) is 1:
                print "No table names specified, importing all."
                util.run_importers(util.IMPORT_LIST,
                                   sqlite_file,
                                   database=database)
            else:
                specified_importers = get_importer_classes_from_arg_list(args)
                start_at_import = options.get('start_at_import')
                print "Importing: %s" % args[1:]

                include_deps = options.get('include_deps')
                if include_deps and not start_at_import:
                    print "Including dependencies."

                if start_at_import:
                    # User wishes to start the import process at a specific
                    # table name. Import the specified importer, and
                    # everything after it.
                    specified_importers = get_importers_for_start_at_import(
                        specified_importers)

                util.run_importers(specified_importers,
                                   sqlite_file,
                                   include_deps=include_deps,
                                   database=database)
        except KeyboardInterrupt:
            print "Terminating early..."
            exit_with_succ()
    def handle(self, *args, **options):
        """
        This is where the user input is handled, and the appropriate
        actions are taken.
        """
        #print "OPTIONS", options
        #print "ARGS:", args

        if len(args) < 1:
            raise CommandError(
                "You must specify the static data dump file to import. This is "
                "probably something in the pattern of *.db3")

        try:
            sqlite_file = args[0]
            check_for_eve_db(sqlite_file)

            database = options.get('database')
            if database:
                print "Using database '%s'" % database

            if len(args) is 1:
                print "No table names specified, importing all."
                util.run_importers(util.IMPORT_LIST, sqlite_file, database=database)
            else:
                specified_importers = get_importer_classes_from_arg_list(args)
                start_at_import = options.get('start_at_import')
                print "Importing: %s" % args[1:]

                include_deps = options.get('include_deps')
                if include_deps and not start_at_import:
                    print "Including dependencies."

                if start_at_import:
                    # User wishes to start the import process at a specific
                    # table name. Import the specified importer, and
                    # everything after it.
                    specified_importers = get_importers_for_start_at_import(specified_importers)

                util.run_importers(specified_importers, sqlite_file,
                                   include_deps=include_deps, database=database)
        except KeyboardInterrupt:
            print "Terminating early..."
            exit_with_succ()