From: Radek Czajka Date: Mon, 26 May 2014 14:52:34 +0000 (+0200) Subject: Allow adding fake publish records. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/f2ed7d5158a1d6508b1382a384e32e22371a80b6?ds=inline;hp=ec6680ed1179840f341ae507ba78320cd23a838e Allow adding fake publish records. --- diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 5902ae9e..a30931da 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -416,14 +416,15 @@ class Book(models.Model): parse_dublincore=parse_dublincore, strict=strict) - def publish(self, user): + def publish(self, user, fake=False): """ Publishes a book on behalf of a (local) user. """ self.assert_publishable() changes = self.get_current_changes(publishable=True) book_xml = self.materialize(changes=changes) - apiclient.api_call(user, "books/", {"book_xml": book_xml}) + if not fake: + apiclient.api_call(user, "books/", {"book_xml": book_xml}) # record the publish br = BookPublishRecord.objects.create(book=self, user=user) for c in changes: