From: Roland Häder Date: Wed, 17 Apr 2024 19:38:13 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=11065bb66a8b574db036bfbaa36494747104ad40;p=fba.git Continued: - renamed local (overwritten) variable 'blocked' to 'cleared' so the array index can be found again --- diff --git a/fba/networks/pleroma.py b/fba/networks/pleroma.py index c38c2da..08a1b20 100644 --- a/fba/networks/pleroma.py +++ b/fba/networks/pleroma.py @@ -244,20 +244,23 @@ def fetch_blocks(domain: str) -> list: for blocked in rows: logger.debug("blocked='%s' - BEFORE!", blocked) reason = tidyup.reason(rows[blocked]["reason"]) if rows[blocked]["reason"] != "" else None - blocked = tidyup.domain(blocked) if blocked != "" else None - logger.debug("blocked='%s',reason='%s' - AFTER!", blocked, reason) + cleaned = tidyup.domain(blocked) if blocked != "" else None + logger.debug("cleaned='%s',reason='%s' - AFTER!", cleaned, reason) - 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) + if cleaned in [None, ""]: + logger.warning("cleaned[%s]='%s' is empty after tidyup.domain(): domain='%s',block_level='%s'", type(cleaned), cleaned, domain, block_level) + continue + elif blocked not in rows: + logger.warning("Cannot find blocked='%s' in rows()=%d: domain='%s',block_level='%s'", blocked,len(rows), 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 + continue logger.debug("Checking %d blockdict record(s) ...", len(blockdict)) for block in blockdict: - logger.debug("block[blocked]='%s',blocked='%s'", block["blocked"], blocked) - if block["blocked"] == blocked: + logger.debug("block[blocked]='%s',cleaned='%s'", block["blocked"], cleaned) + if block["blocked"] == cleaned: logger.debug("Updating reason='%s' for blocker='%s'", reason, block["blocked"]) block["reason"] = reason else: