Skip to content

Commit

Permalink
feat: Add python3.11 compatibility by using inspect.signature
Browse files Browse the repository at this point in the history
  • Loading branch information
franagustin committed Mar 22, 2023
1 parent da7bf07 commit f1d4d2d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion admin_shortcuts/templatetags/admin_shortcuts_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f1d4d2d

Please sign in to comment.