Skip to content

Commit

Permalink
Merge pull request #91 from plone/90-modernize-inspect
Browse files Browse the repository at this point in the history
Remove deprecation warnings
  • Loading branch information
jensens authored Feb 15, 2020
2 parents efdba84 + 770e345 commit 0810e40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/90.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove deprecation warnings
11 changes: 9 additions & 2 deletions plone/protect/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ def __init__(self, *checkers):
self.checkers = checkers

def __call__(self, callable):
spec = inspect.getargspec(callable)
args, defaults = spec[0], spec[3]
try:
spec = inspect.getfullargspec(callable)
except AttributeError:
# Python 2.7 compatibility
spec = inspect.getargspec(callable)

args = spec.args
defaults = spec.defaults

try:
r_index = args.index("REQUEST")
except ValueError:
Expand Down

0 comments on commit 0810e40

Please sign in to comment.