diff options
Diffstat (limited to 'archaeological_operations/management/commands')
-rw-r--r-- | archaeological_operations/management/commands/import_operations.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/archaeological_operations/management/commands/import_operations.py b/archaeological_operations/management/commands/import_operations.py index fe4afc032..92b9cc4b2 100644 --- a/archaeological_operations/management/commands/import_operations.py +++ b/archaeological_operations/management/commands/import_operations.py @@ -24,7 +24,17 @@ from django.core.management.base import BaseCommand, CommandError from archaeological_operations.data_importer import * -IMPORTERS = {'bibracte-operation':OperationImporterBibracte} +IMPORTERS = { + 'bibracte-operation':OperationImporterBibracte, + 'bibracte-parcelle':ParcelImporterBibracte, + } + +try: + from archaeological_context_records.data_importer import * + IMPORTERS['bibracte-UE'] = ContextRecordsImporterBibracte + IMPORTERS['bibracte-rel-UE'] = ContextRecordsRelationImporterBibracte +except ImportError: + pass class Command(BaseCommand): args = '<filename> <importer_name> [<nb lines skipped>]' @@ -36,7 +46,7 @@ class Command(BaseCommand): if len(args) < 2 or args[1] not in IMPORTERS: msg = "Bad importer. \nAvailable importers are:\n" for key in IMPORTERS: - msg += "\t* %s: %s" % (key, IMPORTERS[key].DESC.encode('utf-8') + msg += "\t* %s: %s\n" % (key, IMPORTERS[key].DESC.encode('utf-8') or "-") raise CommandError(msg) try: @@ -76,6 +86,9 @@ class Command(BaseCommand): except IOError: sys.stdout.write("Cannot create CSV error file \"%s\"." % error_file) + sys.stdout.write( + "\n\n* %d item(s) updated, %d item(s) created.\n" % ( + importer.number_updated, importer.number_created)) break except ImporterError, e: if e.type == ImporterError.HEADER and encoding != encodings[-1]: |