From fbc10cff4c1ea91b0a42d2435755d538cce4a241 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 21 Aug 2023 14:01:36 +0200 Subject: [PATCH] Error handling fix. --- src/depot/publishers/woblink.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) -- 2.20.1