From 07f93e28170a9828edffe23aa890b8d55ae04044 Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Fri, 29 Mar 2024 11:37:37 +0530 Subject: [PATCH] fix(generate_hash): Deprecate `txt` parameter - its not used. `length` has a default value anyway, no need of checking and setting a default. Signed-off-by: Akhil Narang --- frappe/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index 4b7c77904b..81c552078a 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -1187,8 +1187,10 @@ def generate_hash(txt: str | None = None, length: int = 56) -> str: import math import secrets - if not length: - length = 56 + if txt: + from frappe.utils.deprecations import deprecation_warning + + deprecation_warning("The `txt` parameter is deprecated and will be removed in a future release.") return secrets.token_hex(math.ceil(length / 2))[:length]