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 <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-03-29 11:37:37 +05:30
parent 1847e9cae8
commit 07f93e2817
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -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]