]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 17 Apr 2024 19:38:13 +0000 (21:38 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 17 Apr 2024 19:38:13 +0000 (21:38 +0200)
- renamed local (overwritten) variable 'blocked' to 'cleared' so the array
  index can be found again

fba/networks/pleroma.py

index c38c2da7b785fc70807556b1c0aefd096c50aaf5..08a1b20a0c5e849c8c83ee0daeca0544dc41d375 100644 (file)
@@ -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: