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
评论列表
文章目录