From 30cd6983d7c3ce7a593d3f3c09560679ce1d3f26 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 22 Aug 2012 10:45:43 +0200 Subject: [PATCH] Fix checking ready for publishing. --- apps/catalogue/models/book.py | 10 +++++----- lib/librarian | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index a8a3f20c..25b9304e 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -255,13 +255,11 @@ class Book(models.Model): changes = self.get_current_changes(publishable=True) except self.NoTextError: raise AssertionError(_('Not all chunks have publishable revisions.')) - book_xml = self.materialize(changes=changes) - from librarian.dcparser import BookInfo from librarian import NoDublinCore, ParseError, ValidationError try: - bi = BookInfo.from_string(book_xml.encode('utf-8'), strict=True) + bi = self.wldocument(changes=changes, strict=True).book_info except ParseError, e: raise AssertionError(_('Invalid XML') + ': ' + unicode(e)) except NoDublinCore: @@ -397,14 +395,16 @@ class Book(models.Model): changes = self.get_current_changes(publishable) return compile_text(change.materialize() for change in changes) - def wldocument(self, publishable=True, changes=None, parse_dublincore=True): + def wldocument(self, publishable=True, changes=None, + parse_dublincore=True, strict=False): from catalogue.ebook_utils import RedakcjaDocProvider from librarian.parser import WLDocument return WLDocument.from_string( self.materialize(publishable=publishable, changes=changes), provider=RedakcjaDocProvider(publishable=publishable), - parse_dublincore=parse_dublincore) + parse_dublincore=parse_dublincore, + strict=strict) def publish(self, user): """ diff --git a/lib/librarian b/lib/librarian index fed2483b..cbe81ee3 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit fed2483b39e23ecd91ec2d04495a4caac208e94c +Subproject commit cbe81ee35b07783b4f52c3d3dda83db7aaf82d34 -- 2.20.1