From f1d4d2dfdf53c0ca3d65e11f309589d04494b436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Agust=C3=ADn?= Date: Wed, 22 Mar 2023 01:53:09 -0300 Subject: [PATCH] feat: Add python3.11 compatibility by using inspect.signature --- admin_shortcuts/templatetags/admin_shortcuts_tags.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin_shortcuts/templatetags/admin_shortcuts_tags.py b/admin_shortcuts/templatetags/admin_shortcuts_tags.py index 3482c3c..a85a23b 100644 --- a/admin_shortcuts/templatetags/admin_shortcuts_tags.py +++ b/admin_shortcuts/templatetags/admin_shortcuts_tags.py @@ -123,7 +123,10 @@ def eval_func(func_path, request): module = import_module(module_str) result = getattr(module, func_str) if callable(result): - args, varargs, keywords, defaults = inspect.getargspec(result) + try: + args = inspect.signature(result).parameters + except AttributeError: # Python version < 3.3 + args = inspect.getargspec(result)[0] if 'request' in args: result = result(request) else: