scope.py 文件源码

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

项目:auth-srv 作者: openpermissions 项目源码 文件源码
def _check_access_resource_ids(self, func, resources):
        """
        Check resource identified by an ID exist and then call func for
        each resource
        """
        if not resources:
            raise Return()

        for resource_id in resources:
            try:
                doc = yield views.service_and_repository.first(key=resource_id)
            except couch.NotFound:
                raise InvalidScope('Scope contains an unknown resource ID')

            resource = RESOURCE_TYPES[doc['value']['type']](**doc['value'])
            try:
                yield resource.get_parent()
            except couch.NotFound:
                raise InvalidScope('Invalid resource - missing parent')
            func(resource, resources[resource_id])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号