rest.py 文件源码

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

项目:guernsey 作者: ingnil 项目源码 文件源码
def getRoot(self):
        depth = 0
        if not self.root:
            p = self
            while p.getParent() != None and depth < self._maxResourceDepth:
                if p is p.getParent():
                    self.logger.error("Loop in resource parent link. "
                                      "Parent link points back to this resource.")
                    return None
                p = p.getParent()
                depth += 1
            if isinstance(p, RootResource):
                return p
            elif depth >= self._maxResourceDepth:
                self.logger.error("Possible loop in resource parent links, aborting search")
                return None
            else:
                return None
        return self.root
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号