From 826e397f194469c64aabeb9f1f8ea6a6e927f8a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 28 Feb 2024 18:12:22 +0100 Subject: [PATCH] Continued: - also log parameter 'column' - blocks.add() should not be invoked with 'blocker' is already blocking 'blocked' at 'block_level' --- fba/models/blocks.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fba/models/blocks.py b/fba/models/blocks.py index 601db5d..3ad164e 100644 --- a/fba/models/blocks.py +++ b/fba/models/blocks.py @@ -143,6 +143,8 @@ def add(blocker: str, blocked: str, reason: str, block_level: str): raise Exception(f"blocker='{blocker}' is blacklisted but function invoked") elif blacklist.is_blacklisted(blocked): raise Exception(f"blocked='{blocked}' is blacklisted but function invoked") + elif is_instance_blocked(blocker, blocked, block_level): + raise Exception(f"blocker='{blocker}' is already blocking blocked='{blocked}' with block_level='{block_level}' but function was invoked") elif reason is not None and reason == "": raise Exception(f"blocker='{blocker}',blocked='{blocked}',block_level='{block_level}' has empty (not 'None') block reason set") @@ -166,7 +168,7 @@ def add(blocker: str, blocked: str, reason: str, block_level: str): logger.debug("EXIT!") def valid(value: str, column: str) -> bool: - logger.debug("value='%s' - CALLED!", value) + logger.debug("value='%s',column='%s' - CALLED!", value, column) if not isinstance(value, str): raise ValueError(f"Parameter value[]='{type(value)}' is not of type 'str'") @@ -188,7 +190,7 @@ def valid(value: str, column: str) -> bool: return is_valid def translate_idnas(rows: list, column: str): - logger.debug("rows[]='%s' - CALLED!", type(rows)) + logger.debug("rows[]='%s',column='%s' - CALLED!", type(rows), column) if not isinstance(rows, list): raise ValueError(f"rows[]='{type(rows)}' is not of type 'list'") @@ -221,7 +223,7 @@ def alias_block_level(block_level: str) -> str: if not isinstance(block_level, str): raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'") elif block_level in ["accept", "accepted"]: - raise ValueError(f"Parameter block_level='{block_level}' is not accepted but function was invoked") + raise ValueError(f"Parameter block_level='{block_level}' is 'accept(ed)' but function was invoked") elif block_level == "silence": logger.debug("Block level 'silence' has been changed to 'silenced'") block_level = "silenced" -- 2.39.5