diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-01-27 15:26:09 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-01-27 15:26:09 +0100 |
commit | 4b8571e492a342314c6a68dbb80b5c48f76ffd4e (patch) | |
tree | 70d2aa4499630be5305124b5f3f940c9b9c7b45f /archaeological_operations/management/commands | |
parent | 97a7791ace5e6706f88d163c23a1f2ad6746eb9c (diff) | |
download | Ishtar-4b8571e492a342314c6a68dbb80b5c48f76ffd4e.tar.bz2 Ishtar-4b8571e492a342314c6a68dbb80b5c48f76ffd4e.zip |
Bibracte import for context records.
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]: |