Officially, "inspect.getargspec" is obsoleted in Python 3.0, this patch fixes to avoid using this function.
Signed-off-by: IWASE Yusuke <[email protected]> --- ryu/app/wsgi.py | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py index 1e19fed..7d7f130 100644 --- a/ryu/app/wsgi.py +++ b/ryu/app/wsgi.py @@ -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): -- 2.7.4 ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
