diff options
author | Tim Burke <tim.burke@gmail.com> | 2020-06-18 09:41:46 -0700 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2020-06-18 09:41:46 -0700 |
commit | 481f126e6b59689599f438e5d27f7328f5b3e813 (patch) | |
tree | 14212db13aee782e95ffd36993d74c6bf35df0cb /swift/common/swob.py | |
parent | b3fd0bd9d82160305a821e742b2cd968036911b2 (diff) | |
parent | 51a587ed8dd5700b558ad26d70dcb7facc0f91e4 (diff) | |
download | swift-feature/losf.tar.gz |
Merge remote-tracking branch 'gerrit/master' into feature/losffeature/losf
Change-Id: If9d7c63f3c4c15fbccff31e2b77a6911bb95972a
Diffstat (limited to 'swift/common/swob.py')
-rw-r--r-- | swift/common/swob.py | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/swift/common/swob.py b/swift/common/swob.py index 61b66793c..76fb2fbc9 100644 --- a/swift/common/swob.py +++ b/swift/common/swob.py @@ -43,7 +43,6 @@ from email.utils import parsedate import re import random import functools -import inspect from io import BytesIO import six @@ -1563,23 +1562,15 @@ def wsgify(func): return a Response object into WSGI callables. Also catches any raised HTTPExceptions and treats them as a returned Response. """ - argspec = inspect.getargspec(func) - if argspec.args and argspec.args[0] == 'self': - @functools.wraps(func) - def _wsgify_self(self, env, start_response): - try: - return func(self, Request(env))(env, start_response) - except HTTPException as err_resp: - return err_resp(env, start_response) - return _wsgify_self - else: - @functools.wraps(func) - def _wsgify_bare(env, start_response): - try: - return func(Request(env))(env, start_response) - except HTTPException as err_resp: - return err_resp(env, start_response) - return _wsgify_bare + @functools.wraps(func) + def _wsgify(*args): + env, start_response = args[-2:] + new_args = args[:-2] + (Request(env), ) + try: + return func(*new_args)(env, start_response) + except HTTPException as err_resp: + return err_resp(env, start_response) + return _wsgify class StatusMap(object): |