Fix
authorRadek Czajka <rczajka@rczajka.pl>
Mon, 16 Oct 2023 13:30:56 +0000 (15:30 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Mon, 16 Oct 2023 13:30:56 +0000 (15:30 +0200)
src/depot/publishers/legimi.py
src/depot/publishers/woblink.py

index e6fe5b5..da22245 100644 (file)
@@ -130,12 +130,16 @@ class Legimi(BasePublisher):
             })
 
     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(
index c3ec7a5..0cd7a89 100644 (file)
@@ -313,12 +313,16 @@ class Woblink(BasePublisher):
         return price
 
     def can_publish(self, site, book):
-        wldoc = book.wldocument(librarian2=True)
         d = {
             'warnings': [],
             'errors': [],
             'info': [],
         }
+        try:
+            wldoc = book.wldocument(librarian2=True)
+        except:
+            d['errors'].append('Nieprawidłowy dokument.')
+            return d
         errors = []
         book_data = self.get_book_data(site, wldoc, errors)
         for error in errors: