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 django.core.management.base import BaseCommand
|
||||||
|
|
||||||
from drupal2spip_lal.base.convert import convert_node
|
from drupal2spip_lal.base.convert import convert_node
|
||||||
from drupal2spip_lal.drupal.models import Node
|
from drupal2spip_lal.drupal.models import Node
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger('drupal2spip_lal')
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = "Import Drupal nodes to SPIP articles."
|
help = "Import Drupal nodes to SPIP articles."
|
||||||
|
|
||||||
|
@ -26,7 +31,10 @@ class Command(BaseCommand):
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, **options):
|
def handle(self, **options):
|
||||||
[
|
for n in Node.objects.filter(pk__in=options.get('node', [])):
|
||||||
convert_node(n, options)
|
try:
|
||||||
for n in Node.objects.filter(pk__in=options.get('node', []))
|
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