From f2ed7d5158a1d6508b1382a384e32e22371a80b6 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 26 May 2014 16:52:34 +0200 Subject: [PATCH] Allow adding fake publish records. --- apps/catalogue/models/book.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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: -- 2.20.1