# Now search regexp routes # ROUTES_REGEXP是一个字典,键是请求方法,值是[路由, 处理函数]的列表 # 例如:{"GET", [[路由1, 处理函数1], [路由2, 处理函数2]]} routes = ROUTES_REGEXP.get(method,[]) for i in xrange(len(routes)): match = routes[i][0].match(url) if match: handler = routes[i][1…
# Routing def compile_route(route): """ Compiles a route string and returns a precompiled RegexObject. Routes may contain regular expressions with named groups to support url parameters. Example: '/user/(?P<id>[0-9]+)' will match '/us…