typo
[redakcja.git] / src / depot / publishers / base.py
index dbf14ab..cdc1ff3 100644 (file)
@@ -17,7 +17,7 @@ class BasePublisher:
             self.login()
         return self._session
 
             self.login()
         return self._session
 
-    def send_book(self, shop, book, changes=None):
+    def send_book(self, site_book_publish, changes=None):
         raise NotImplementedError()
 
     def get_description(self, wlbook, description_add=''):
         raise NotImplementedError()
 
     def get_description(self, wlbook, description_add=''):
@@ -25,7 +25,7 @@ class BasePublisher:
 
         if wlbook.meta.audience in ('L', 'SP1', 'SP2', 'SP3', 'SP4'):
             description += '<p><em>{}</em> to lektura szkolna.'.format(wlbook.meta.title)
 
         if wlbook.meta.audience in ('L', 'SP1', 'SP2', 'SP3', 'SP4'):
             description += '<p><em>{}</em> to lektura szkolna.'.format(wlbook.meta.title)
-            if wlbook.tree.find('//pe') is not None:
+            if wlbook.tree.find('.//pe') is not None:
                 description += '<br>Ebook <em>{title}</em> zawiera przypisy opracowane specjalnie dla uczennic i uczniów {school}.'.format(
                     title=wlbook.meta.title,
                     school='szkoły podstawowej' if wlbook.meta.audience.startswith('SP') else 'liceum i technikum'
                 description += '<br>Ebook <em>{title}</em> zawiera przypisy opracowane specjalnie dla uczennic i uczniów {school}.'.format(
                     title=wlbook.meta.title,
                     school='szkoły podstawowej' if wlbook.meta.audience.startswith('SP') else 'liceum i technikum'
@@ -41,34 +41,35 @@ class BasePublisher:
             '<a href="https://wolnelektury.pl/katalog/autor/{}/">{}</a>'.format(
                 slugify(p.readable()),
                 p.readable(),
             '<a href="https://wolnelektury.pl/katalog/autor/{}/">{}</a>'.format(
                 slugify(p.readable()),
                 p.readable(),
-            )
+            ) if p is not None else ''
             for p in wlbook.meta.authors
         ) + '<br>'
             for p in wlbook.meta.authors
         ) + '<br>'
-        description += '<a href="https://wolnelektury.pl/katalog/lektura/{}/">{}</a><br>'.format(
-            wlbook.meta.url.slug,
-            wlbook.meta.title
-        )
+        if wlbook.meta.url is not None:
+            description += '<a href="https://wolnelektury.pl/katalog/lektura/{}/">{}</a><br>'.format(
+                wlbook.meta.url.slug,
+                wlbook.meta.title
+            )
         if wlbook.meta.translators:
             description += 'tłum. ' + ', '.join(p.readable() for p in wlbook.meta.translators) + '<br>'
         description += 'Epoka: ' + ', '.join(
             '<a href="https://wolnelektury.pl/katalog/epoka/{}/">{}</a>'.format(
                 slugify(p),
                 p,
         if wlbook.meta.translators:
             description += 'tłum. ' + ', '.join(p.readable() for p in wlbook.meta.translators) + '<br>'
         description += 'Epoka: ' + ', '.join(
             '<a href="https://wolnelektury.pl/katalog/epoka/{}/">{}</a>'.format(
                 slugify(p),
                 p,
-            )
+            ) if p is not None else ''
             for p in wlbook.meta.epochs
         ) + ' '
         description += 'Rodzaj: ' + ', '.join(
             '<a href="https://wolnelektury.pl/katalog/rodzaj/{}/">{}</a>'.format(
                 slugify(p),
                 p,
             for p in wlbook.meta.epochs
         ) + ' '
         description += 'Rodzaj: ' + ', '.join(
             '<a href="https://wolnelektury.pl/katalog/rodzaj/{}/">{}</a>'.format(
                 slugify(p),
                 p,
-            )
+            ) if p is not None else ''
             for p in wlbook.meta.kinds
         ) + ' '
         description += 'Gatunek: ' + ', '.join(
             '<a href="https://wolnelektury.pl/katalog/gatunek/{}/">{}</a>'.format(
                 slugify(p),
                 p,
             for p in wlbook.meta.kinds
         ) + ' '
         description += 'Gatunek: ' + ', '.join(
             '<a href="https://wolnelektury.pl/katalog/gatunek/{}/">{}</a>'.format(
                 slugify(p),
                 p,
-            )
+            ) if p is not None else ''
             for p in wlbook.meta.genres
         ) + '</p>'
 
             for p in wlbook.meta.genres
         ) + '</p>'