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: