From 3f3821befb814bc909fc7caaf64edc6a31ca6da2 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Sat, 5 Aug 2023 13:02:50 +0530 Subject: [PATCH] fix: dont use `form_dict` & `frappe.call` --- frappe/rate_limiter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/rate_limiter.py b/frappe/rate_limiter.py index 73cb077972..75eb6922f9 100644 --- a/frappe/rate_limiter.py +++ b/frappe/rate_limiter.py @@ -107,14 +107,14 @@ def rate_limit( :returns: a decorator function that limit the number of requests per endpoint """ - def ratelimit_decorator(fun): - @wraps(fun) + def ratelimit_decorator(fn): + @wraps(fn) def wrapper(*args, **kwargs): # Do not apply rate limits if method is not opted to check if not frappe.request or ( methods != "ALL" and frappe.request.method and frappe.request.method.upper() not in methods ): - return frappe.call(fun, **frappe.form_dict or kwargs) + return fn(*args, **kwargs) _limit = limit() if callable(limit) else limit @@ -144,7 +144,7 @@ def rate_limit( _("You hit the rate limit because of too many requests. Please try after sometime.") ) - return frappe.call(fun, **frappe.form_dict or kwargs) + return fn(*args, **kwargs) return wrapper