summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/app/wsgi.py26
1 files changed, 9 insertions, 17 deletions
diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py
index 1e19fed0..7d7f1306 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):