From: Radek Czajka Date: Mon, 21 Aug 2023 12:01:36 +0000 (+0200) Subject: Error handling fix. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/fbc10cff4c1ea91b0a42d2435755d538cce4a241?ds=inline Error handling fix. --- diff --git a/src/depot/publishers/woblink.py b/src/depot/publishers/woblink.py index c8037fa4..8472a180 100644 --- a/src/depot/publishers/woblink.py +++ b/src/depot/publishers/woblink.py @@ -271,7 +271,7 @@ class Woblink(BasePublisher): parts[1] = m.group(0) + parts[1] opened = [] - for tag in re.findall(r'<[^>]+[^/>]>', parts[0]): + for tag in re.findall(r'<[^>]*[^/>]>', parts[0]): if tag[1] == '/': opened.pop() else: @@ -288,7 +288,12 @@ class Woblink(BasePublisher): return lang_code_3to2(meta.language) def get_price(self, shop, wldoc, errors=None): - stats = wldoc.get_statistics()['total'] + try: + stats = wldoc.get_statistics()['total'] + except: + if errors: + errors.append(NoPrice(shop)) + return 0 words = stats['words_with_fn'] pages = stats['chars_with_fn'] / 1800 price = shop.get_price(words, pages)