diff --git a/drupal2spip_lal/base/management/commands/import.py b/drupal2spip_lal/base/management/commands/import.py index 83a243b..dca7c59 100644 --- a/drupal2spip_lal/base/management/commands/import.py +++ b/drupal2spip_lal/base/management/commands/import.py @@ -1,9 +1,14 @@ +import logging + from django.core.management.base import BaseCommand from drupal2spip_lal.base.convert import convert_node from drupal2spip_lal.drupal.models import Node +logger = logging.getLogger('drupal2spip_lal') + + class Command(BaseCommand): help = "Import Drupal nodes to SPIP articles." @@ -26,7 +31,10 @@ class Command(BaseCommand): ) def handle(self, **options): - [ - convert_node(n, options) - for n in Node.objects.filter(pk__in=options.get('node', [])) - ] + for n in Node.objects.filter(pk__in=options.get('node', [])): + try: + convert_node(n, options) + except Exception as e: + logger.critical( + "L'import du node {} a échoué : {}".format(n.pk, e) + )