web.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:xr-telemetry-m2m-web 作者: cisco 项目源码 文件源码
def getChild(self, name, request):
        """
        Dispatch a specific incoming request to an appropriate resource
        """
        # First try: static resource
        static = self.static.handle_static(request)
        if static:
            return static

        # If that doesn't serve the request, try the plugin dynamic path
        if request.path in self.path_map:
            print 'using plugin %s for %s' % (self.path_map[request.path], request.path)
            cfg = self.cfg.copy()
            cfg['tab_map'] = self.tab_map
            for arg in request.args:
                if arg not in cfg:
                    cfg[arg] = request.args[arg][0]
            # Augment the request with our own session data
            request.sdata = session.get_data(request)
            return self.path_map[request.path](cfg)

        # Nothing else to try
        print 'Failed to match path', request.path, 'to any plugins', self.path_map
        return NoResource()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号