model_base.py 文件源码

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

项目:flask-gae-ndb-starter 作者: jideobs 项目源码 文件源码
def _SetAncestor(self, value):
        """Setter to be used for public ancestor property on query info.

Args:
  value: A potential value for an ancestor.

Raises:
  AttributeError: if query on the object is already final.
  AttributeError: if the ancestor has already been set.
  TypeError: if the value to be set is not an instance of ndb.Key.
"""
        if self._query_final is not None:
            raise AttributeError('Can\'t set ancestor. Query info is final.')

        if self._ancestor is not None:
            raise AttributeError('Ancestor can\'t be set twice.')
        if not isinstance(value, ndb.Key):
            raise TypeError('Ancestor must be an instance of ndb.Key.')
        self._ancestor = value
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号