mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-09 22:36:10 +02:00
wsgi: Avoid using inspect.getargspec
Officially, "inspect.getargspec" is obsoleted in Python 3.0, this patch fixes to avoid using this function. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
99ebbcce0e
commit
9f04612459
@ -225,23 +225,15 @@ class WSGIApplication(object):
|
||||
self.registory = {}
|
||||
self._wsmanager = WebSocketManager()
|
||||
super(WSGIApplication, self).__init__()
|
||||
# XXX: Switch how to call the API of Routes for every version
|
||||
match_argspec = inspect.getargspec(self.mapper.match)
|
||||
if 'environ' in match_argspec.args:
|
||||
# New API
|
||||
self._match = self._match_with_environ
|
||||
else:
|
||||
# Old API
|
||||
self._match = self._match_with_path_info
|
||||
|
||||
def _match_with_environ(self, req):
|
||||
match = self.mapper.match(environ=req.environ)
|
||||
return match
|
||||
|
||||
def _match_with_path_info(self, req):
|
||||
self.mapper.environ = req.environ
|
||||
match = self.mapper.match(req.path_info)
|
||||
return match
|
||||
def _match(self, req):
|
||||
# Note: Invoke the new API, first. If the arguments unmatched,
|
||||
# invoke the old API.
|
||||
try:
|
||||
return self.mapper.match(environ=req.environ)
|
||||
except TypeError:
|
||||
self.mapper.environ = req.environ
|
||||
return self.mapper.match(req.path_info)
|
||||
|
||||
@wsgify_hack
|
||||
def __call__(self, req, start_response):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user