Google app engine Appengine错误对象没有属性'_键';

Google app engine Appengine错误对象没有属性'_键';,google-app-engine,python-2.7,google-cloud-datastore,Google App Engine,Python 2.7,Google Cloud Datastore,我有一个GAE数据库实体,如下所示: class Notification(db.Model): alert = db.StringProperty() type = db.StringProperty() status = db.StringProperty(default="unread", choices=set(["unread", "read"])) created = db.DateTimeProperty(auto_now_add=True)

我有一个GAE数据库实体,如下所示:

class Notification(db.Model):

    alert = db.StringProperty()
    type = db.StringProperty()
    status = db.StringProperty(default="unread", choices=set(["unread", "read"])) 
    created  = db.DateTimeProperty(auto_now_add=True)
    modified = db.DateTimeProperty(auto_now=True)
    entity = db.StringProperty()
    record = db.ReferenceProperty(model.RecordModel)
    actor = db.ReferenceProperty(model.Profile)
    account = db.ReferenceProperty(model.Account)
。。。我创建了这样一个实体:

notify = model2.Notification(account=account)
notify.alert = message
notify.type = "reminder"
notify.actor = actor
notify.record = record
notify.put() 
此调用引发错误*“通知”对象没有属性“\u key”*

nquery = db.Query(model2.Notification).filter('account =', self.session.account).order('-created')            
for n in nquery:
  try:
    _dict = {}
    _dict['serverID'] = str(n.key()) #- raises error! 
尝试:


我想我已经明白了!我的通知类中的“entity”属性在python appengine中引起某种命名冲突。更改名称将删除“错误对象没有属性'\u key')错误。算了吧

这也引发了同样的错误。我甚至尝试将实体重命名为“Notify”,以避免与GAE类发生任何可能的命名冲突,但仍然会引发相同的错误。当我注释掉“n.key()”时,错误消失了。这是令人难以置信的,因为我真的需要得到那个实体密钥!你能发布完整的追踪吗?那里可能有线索。
nquery = Notification.all().filter('account =', self.session.account).order('-created')