From: Radek Czajka Date: Thu, 22 Jul 2010 15:00:10 +0000 (+0200) Subject: fix for files without dc X-Git-Tag: 1.7~277 X-Git-Url: https://git.mdrn.pl/librarian.git/commitdiff_plain/5b174651e7cadaa9c353cd247fbfcde41b012f3a fix for files without dc --- diff --git a/librarian/epub.py b/librarian/epub.py index e54e4cd..139dd39 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -13,7 +13,7 @@ from copy import deepcopy from lxml import etree import zipfile -from librarian import XMLNamespace, RDFNS, DCNS, WLNS, XHTMLNS +from librarian import XMLNamespace, RDFNS, DCNS, WLNS, XHTMLNS, NoDublinCore NCXNS = XMLNamespace("http://www.daisy.org/z3986/2005/ncx/") OPFNS = XMLNamespace("http://www.idpf.org/2007/opf") @@ -211,6 +211,8 @@ def transform(input_file, output_file): '') metadata_el = input_xml.find('.//'+RDFNS('Description')) + if metadata_el is None: + raise NoDublinCore('Document has no DublinCore - which is required.') metadatasource = etree.ElementTree(metadata_el) opf = xslt(metadatasource, res('xsltContent.xsl'))