]> git.mxchange.org Git - fba.git/blobdiff - fba/helpers/processing.py
Continued:
[fba.git] / fba / helpers / processing.py
index 847f9fca2fed7bd9992c931b3beab0973a91434a..cd19eeb6ab66c330b98796b01ad3cf6ce6b92399 100644 (file)
@@ -108,6 +108,10 @@ def block(blocker: str, blocked: str, reason: str, block_level: str) -> bool:
         blocks.add(blocker, blocked, reason, block_level)
         added = True
     else:
+        if reason not in [None, ""] and blocks.get_reason(blocker, blocked, block_level) is None:
+            logger.debug("Updating reason='%s' for blocker='%s',blocked='%s',block_level='%s' ...", reason, blocker, blocked, block_level)
+            blocks.update_reason(reason, blocker, blocked, block_level)
+
         logger.debug("Updating last_seen for blocker='%s',blocked='%s',block_level='%s' ...", blocker, blocked, block_level)
         blocks.update_last_seen(blocker, blocked, block_level)
 
@@ -120,7 +124,7 @@ def csv_block(blocker: str, url: str, command: str):
 
     if not isinstance(url, str):
         raise ValueError(f"url[]='{url}' is not of type 'str'")
-    elif url == "":
+    elif url in [None, ""]:
         raise ValueError("Parameter 'url' is empty")
     elif not validators.url(url):
         raise ValueError(f"Parameter url='{url}' is not a valid URL")