From: Roland Häder Date: Thu, 15 Aug 2024 19:35:57 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a392322149c50eab87700705670642882dc7ea70;p=fba.git Continued: - let also process.block() abort when an unwanted block_level is provided - alias also "reject" to "rejected" --- diff --git a/fba/helpers/processing.py b/fba/helpers/processing.py index 04954d2..464eded 100644 --- a/fba/helpers/processing.py +++ b/fba/helpers/processing.py @@ -97,6 +97,8 @@ def block(blocker: str, blocked: str, reason: str, block_level: str) -> bool: raise ValueError(f"Parameter block_level[]='{type(block_level)}' is not of type 'str'") elif block_level == "": raise ValueError("Parameter block_level is empty") + elif block_level in ["reject", "suspend", "accept", "silence", "nsfw", "quarantined_instances"]: + raise ValueError(f"Parameter block_level='{block_level}' is not supported") elif blacklist.is_blacklisted(blocker): raise ValueError(f"blocker='{blocker}' is blacklisted but function was invoked") elif blacklist.is_blacklisted(blocked): diff --git a/fba/models/blocks.py b/fba/models/blocks.py index c27bad3..1ebe3ea 100644 --- a/fba/models/blocks.py +++ b/fba/models/blocks.py @@ -263,6 +263,9 @@ def alias_block_level(block_level: str) -> str: elif block_level == "suspend": logger.debug("Block level 'suspend' has been changed to 'suspended'") block_level = "suspended" + elif block_level == "reject": + logger.debug("Block level 'reject' has been changed to 'rejected'") + block_level = "rejected" elif block_level == "nsfw": logger.debug("Block level 'nsfw' has been changed to 'media_nsfw'") block_level = "media_nsfw"