fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
project sell info and initial synchro support
[redakcja.git]
/
src
/
depot
/
publishers
/
legimi.py
diff --git
a/src/depot/publishers/legimi.py
b/src/depot/publishers/legimi.py
index
75c21cf
..
da22245
100644
(file)
--- a/
src/depot/publishers/legimi.py
+++ b/
src/depot/publishers/legimi.py
@@
-130,12
+130,16
@@
class Legimi(BasePublisher):
})
def can_publish(self, site, book):
})
def can_publish(self, site, book):
- meta = book.wldocument(librarian2=True).meta
d = {
'errors': [],
'warnings': [],
'info': []
}
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(
thema = self.get_thema(meta)
if thema:
d['info'].append(mark_safe(
@@
-261,7
+265,7
@@
class Legimi(BasePublisher):
site_book.external_id = legimi_id
site_book.save(update_fields=['external_id'])
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:
def get_genre(self, wlbook):
if wlbook.meta.legimi and wlbook.meta.legimi in self.CATEGORIES:
@@
-356,8
+360,9
@@
class Legimi(BasePublisher):
data=current
)
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']
words = book.wldocument(librarian2=True).get_statistics()['total']['words_with_fn']
@@
-369,7
+374,7
@@
class Legimi(BasePublisher):
data = {
'ValidationTrue': 'true',
data = {
'ValidationTrue': 'true',
- 'Id':
book.legimi
_id,
+ 'Id':
site_book.external
_id,
'SalesPromotionId': "0",
'IsLibraryPass': "False",
'OriginalEnterToTheMarketType': "No",
'SalesPromotionId': "0",
'IsLibraryPass': "False",
'OriginalEnterToTheMarketType': "No",
@@
-388,6
+393,6
@@
class Legimi(BasePublisher):
}
self.session.post(
}
self.session.post(
- self.EDIT_SALE_URL %
book.legimi
_id,
+ self.EDIT_SALE_URL %
site_book.external
_id,
data=data
)
data=data
)