From: Jan Szejko Date: Mon, 22 May 2017 14:31:17 +0000 (+0200) Subject: skip books with isbn metadata X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/eab7b3e180b32ddfd25db49fc00070cb8084c714?ds=sidebyside skip books with isbn metadata --- diff --git a/apps/catalogue/management/commands/insert_isbn.py b/apps/catalogue/management/commands/insert_isbn.py index e9727daa..7548cb1f 100644 --- a/apps/catalogue/management/commands/insert_isbn.py +++ b/apps/catalogue/management/commands/insert_isbn.py @@ -69,6 +69,7 @@ class Command(BaseCommand): csvfile.close() for slug, isbn_list in isbn_lists.iteritems(): + print 'processing %s' % slug book = Book.objects.get(dc_slug=slug) chunk = book.chunk_set.first() old_head = chunk.head @@ -76,7 +77,8 @@ class Command(BaseCommand): tree = etree.fromstring(src) isbn_node = tree.find('.//' + DCNS("relation.hasFormat")) if isbn_node is not None: - raise Exception('%s already contains ISBN metadata!' % slug) + print '%s already contains ISBN metadata, skipping' % slug + continue desc = tree.find(".//" + RDFNS("Description")) for format, isbn in isbn_list: for template in ISBN_TEMPLATES: