From: Roland Häder Date: Wed, 17 Apr 2024 18:10:06 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b134fbf5d7013a78a21381e14bcfd056e45b59ea;p=fba.git Continued: - need to check if variable 'blocked' is None or an empty string first - log size (len()) not whole array --- diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index 0da479b..c38c2da 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -247,12 +247,12 @@ def fetch_blocks(domain: str) -> list: blocked = tidyup.domain(blocked) if blocked != "" else None logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason) - if blocked not in rows or "reason" not in rows[blocked]: - logger.warning("Cannot find blocked='%s' in rows()=%d,domain='%s' - BREAK!", blocked, len(rows), domain) - break - elif blocked in [None, ""]: + if blocked in [None, ""]: logger.warning("blocked[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s'", type(blocked), blocked, domain, block_level) continue + elif "reason" not in rows[blocked]: + logger.warning("Cannot find 'reason' in rows[%s]()=%d,domain='%s' - BREAK!", blocked, len(rows[blocked]), domain) + break logger.debug("Checking %d blockdict record(s) ...", len(blockdict)) for block in blockdict: @@ -272,7 +272,7 @@ def fetch_blocks(domain: str) -> list: if len(blocklist) > 0: logger.info("Checking %d different blocklist(s) ...", len(blocklist)) for block_level in blocklist: - logger.debug("Checking blocklist[%s]()=%d entries ...", block_level, blocklist[block_level]) + logger.debug("Checking blocklist[%s]()=%d entries ...", block_level, len(blocklist[block_level])) for block in blocklist[block_level]: logger.debug("Appending blocker='%s',block[blocked]='%s',block[reason]='%s',block_level='%s' ...",domain, block["blocked"], block["reason"], block_level) blockdict.append({