fnp
/
redakcja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5709ad9
)
skip books with isbn metadata
author
Jan Szejko
<janek37@gmail.com>
Mon, 22 May 2017 14:31:17 +0000
(16:31 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Mon, 22 May 2017 14:31:17 +0000
(16:31 +0200)
apps/catalogue/management/commands/insert_isbn.py
patch
|
blob
|
history
diff --git
a/apps/catalogue/management/commands/insert_isbn.py
b/apps/catalogue/management/commands/insert_isbn.py
index
e9727da
..
7548cb1
100644
(file)
--- 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():
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
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:
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:
desc = tree.find(".//" + RDFNS("Description"))
for format, isbn in isbn_list:
for template in ISBN_TEMPLATES: