From 5b174651e7cadaa9c353cd247fbfcde41b012f3a Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 22 Jul 2010 17:00:10 +0200 Subject: [PATCH] fix for files without dc --- librarian/epub.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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')) -- 2.20.1