From 0dfd9e79798be2e748877183784b54975d907921 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 22 Jun 2023 21:19:00 +0200 Subject: [PATCH] Continued: - don't re-check/tidy-up block reason and domain if already done --- fba/networks/mastodon.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fba/networks/mastodon.py b/fba/networks/mastodon.py index 7271847..47f19c0 100644 --- a/fba/networks/mastodon.py +++ b/fba/networks/mastodon.py @@ -190,7 +190,7 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: logger.debug(f"block[]='{type(block)}' is of type 'dict' - SKIPPED!") continue - reason = tidyup.reason(block["comment"]) if "comment" in block else None + reason = tidyup.reason(block["comment"]) if "comment" in block and block['comment'] is not None and block['comment'] != "" else None logger.debug("Appending blocker='%s',blocked='%s',reason='%s',block_level='%s'", domain, block['domain'], reason, block['severity']) blocklist.append({ @@ -203,13 +203,6 @@ def fetch_blocks(domain: str, nodeinfo_url: str) -> list: else: logger.debug("domain='%s' has no block list") - logger.info("Checking %d entries from domain='%s' ...", len(blocklist), domain) - for block in blocklist: - logger.debug("blocker='%s',blocked='%s',reason='%s',block_level='%s'", block['blocker'], block['blocked'], block['reason'], block['block_level']) - block['blocked'] = tidyup.domain(block['blocked']) - block['reason'] = tidyup.reason(block['reason']) - logger.debug("blocked='%s',reason='%s' - AFTER!", block['blocked'], block['reason']) - except network.exceptions as exception: logger.warning("domain='%s',exception[%s]='%s'", domain, type(exception), str(exception)) instances.set_last_error(domain, exception) -- 2.39.5