From 6d399587b7c6aeedda4dd12af90ceafaeac65d59 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 22 Jul 2010 17:01:49 +0200 Subject: [PATCH] fix for files with no dc --- apps/catalogue/models.py | 11 +++++++---- lib/librarian | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 8c83faa53..dd251c16a 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -17,7 +17,7 @@ from newtagging.models import TagBase, tags_updated from newtagging import managers from catalogue.fields import JSONField -from librarian import dcparser, html, epub +from librarian import dcparser, html, epub, NoDublinCore from mutagen import id3 @@ -406,9 +406,12 @@ class Book(models.Model): # Create EPUB epub_file = StringIO() - epub.transform(book.xml_file, epub_file) - book.epub_file.save('%s.epub' % book.slug, ContentFile(epub_file.getvalue()), save=False) - FileRecord(slug=book.slug, type='epub', sha1=sha1(epub_file.getvalue()).hexdigest()).save() + try: + epub.transform(book.xml_file, epub_file) + book.epub_file.save('%s.epub' % book.slug, ContentFile(epub_file.getvalue()), save=False) + FileRecord(slug=book.slug, type='epub', sha1=sha1(epub_file.getvalue()).hexdigest()).save() + except NoDublinCore: + pass # Extract fragments closed_fragments, open_fragments = html.extract_fragments(book.html_file.path) diff --git a/lib/librarian b/lib/librarian index 4edcff3a9..5b174651e 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit 4edcff3a9e2a4bb2ecb7ab228e5bf37dd28d7e14 +Subproject commit 5b174651e7cadaa9c353cd247fbfcde41b012f3a -- 2.20.1