From e2a3e0f53a0d40e2f5ce59b1a32abfc7cbf051df Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Tue, 30 Mar 2021 20:00:05 +0530 Subject: [PATCH] fix: return method if method is being passed --- frappe/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index c3667d9637..11c1f324ad 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -558,8 +558,10 @@ def whitelist(allow_guest=False, xss_safe=False, methods=None): # get function from the unbound / bound method # this is needed because functions can be compared, but not methods + method = None if hasattr(fn, '__func__'): - fn = fn.__func__ + method = fn + fn = method.__func__ whitelisted.append(fn) allowed_http_methods_for_whitelisted_func[fn] = methods @@ -570,7 +572,7 @@ def whitelist(allow_guest=False, xss_safe=False, methods=None): if xss_safe: xss_safe_methods.append(fn) - return fn + return method or fn return innerfn