})
def can_publish(self, site, book):
- meta = book.wldocument(librarian2=True).meta
d = {
'errors': [],
'warnings': [],
'info': []
}
+ try:
+ meta = book.wldocument(librarian2=True).meta
+ except:
+ d['errors'].append('Nieprawidłowy dokument.')
+ return d
thema = self.get_thema(meta)
if thema:
d['info'].append(mark_safe(
site_book.external_id = legimi_id
site_book.save(update_fields=['external_id'])
- self.edit_sale(book)
+ self.edit_sale(site_book)
def get_genre(self, wlbook):
if wlbook.meta.legimi and wlbook.meta.legimi in self.CATEGORIES:
data=current
)
- def edit_sale(self, book):
- assert book.legimi_id
+ def edit_sale(self, site_book):
+ book = site_book.book
+ assert site_book.external_id
words = book.wldocument(librarian2=True).get_statistics()['total']['words_with_fn']
data = {
'ValidationTrue': 'true',
- 'Id': book.legimi_id,
+ 'Id': site_book.external_id,
'SalesPromotionId': "0",
'IsLibraryPass': "False",
'OriginalEnterToTheMarketType': "No",
}
self.session.post(
- self.EDIT_SALE_URL % book.legimi_id,
+ self.EDIT_SALE_URL % site_book.external_id,
data=data
)