Merge "Replace deprecated inspect function in Python 3"

This commit is contained in:
Jenkins 2017-07-05 12:46:14 +00:00 committed by Gerrit Code Review
commit 7af4801aad

View File

@ -15,7 +15,13 @@
"""Base class(es) for WSGI Middleware.""" """Base class(es) for WSGI Middleware."""
from inspect import getargspec import six
if six.PY2:
from inspect import getargspec as getfullargspec
else:
from inspect import getfullargspec
import webob.dec import webob.dec
import webob.request import webob.request
import webob.response import webob.response
@ -124,7 +130,7 @@ class ConfigurableMiddleware(object):
return response return response
response = req.get_response(self.application) response = req.get_response(self.application)
(args, varargs, varkw, defaults) = getargspec(self.process_response) args = getfullargspec(self.process_response)[0]
if 'request' in args: if 'request' in args:
return self.process_response(response, request=req) return self.process_response(response, request=req)
return self.process_response(response) return self.process_response(response)