From: Roland Häder Date: Sun, 9 Jul 2023 17:47:11 +0000 (+0200) Subject: Fixed: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5ccbe22470977977fe4ea041f15e88394f7c9d67;p=fba.git Fixed: - ops, to much renames, named 'domains' back to 'blocklist' - also need to check combined arrays, or else always 2 will be found - need to invoke commit() in sources.update() function --- diff --git a/fba/commands.py b/fba/commands.py index f603134..a2cbe6f 100644 --- a/fba/commands.py +++ b/fba/commands.py @@ -632,7 +632,7 @@ def fetch_cs(args: argparse.Namespace): "wikilinks" ] - domains = { + blocklist = { "silenced": list(), "reject" : list(), } @@ -653,11 +653,11 @@ def fetch_cs(args: argparse.Namespace): silenced = doc.find("h2", {"id": "silenced-instances"}).findNext("table").find("tbody") logger.debug("silenced[%s]()=%d", type(silenced), len(silenced)) - domains["silenced"] = federation.find_domains(silenced) + blocklist["silenced"] = federation.find_domains(silenced) blocked = doc.find("h2", {"id": "blocked-instances"}).findNext("table").find("tbody") logger.debug("blocked[%s]()=%d", type(blocked), len(blocked)) - domains["reject"] = federation.find_domains(blocked) + blocklist["reject"] = federation.find_domains(blocked) blocking = blocklist["silenced"] + blocklist["reject"] blocker = "chaos.social" @@ -665,14 +665,13 @@ def fetch_cs(args: argparse.Namespace): logger.debug("Invoking instances.set_total_blocks(%s, %d) ...", blocker, len(blocking)) instances.set_total_blocks(blocker, blocking) - logger.debug("domains[silenced]()=%d,domains[reject]()=%d", len(domains["silenced"]), len(domains["reject"])) + logger.debug("blocklist[silenced]()=%d,blocklist[reject]()=%d", len(blocklist["silenced"]), len(blocklist["reject"])) blockdict = list() - if len(domains) > 0: - - for block_level in domains: - logger.info("block_level='%s' has %d row(s)", block_level, len(domains[block_level])) + if len(blocking) > 0: + for block_level in blocklist: + logger.info("block_level='%s' has %d row(s)", block_level, len(blocklist[block_level])) - for row in domains[block_level]: + for row in blocklist[block_level]: logger.debug("row[%s]='%s'", type(row), row) if instances.is_recent(row["domain"], "last_blocked"): logger.debug("row[domain]='%s' has been recently crawled - SKIPPED!", row["domain"]) diff --git a/fba/models/sources.py b/fba/models/sources.py index 55ace81..75ddcf4 100644 --- a/fba/models/sources.py +++ b/fba/models/sources.py @@ -70,4 +70,7 @@ def update (source_domain: str): source_domain ]) + logger.debug("Invoking commit() ...") + database.connection.commit() + logger.debug("EXIT!")