ref(import): attrape les exceptions
This commit is contained in:
parent
08cc965af4
commit
1bfcbd6086
@ -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)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user