Google 应用引擎返回“BadRequestError:事务中只允许祖先查询”。这在代码上下文中意味着什么:
class Counter(db.Model):
totalRegistrations = db.IntegerProperty(default=0)
@db.transactional
def countUsers():
counter = Counter.all().get()
counter.totalRegistrations = counter.totalRegistrations + 1
counter.put()
i = counter.totalRegistrations
return i
print countUsers()