バグを解決しようとしています。次の関数は、タブと呼ばれるユーザーの属性に Key オブジェクトを追加します。何らかの理由でput()
、ユーザー エンティティを呼び出した後、新しく追加されたキーが保存されません。理由がわかりませんでした。たぶん、変更がすぐに表示されないほどの遅延がありますか? その場合、memcache が解決策になりますか?
class User(GeoModel):
tabs = db.ListProperty(db.Key)
@db.transactional
def add_tab_transaction(self, user_key, tab_key):
user = models.User.get(user_key)
user.tabs.append(tab_key)
user.put()
logging.debug('tabs this user has:')
logging.debug(user.tabs) # prints the list with the new value
user = models.User.get(user_key)
logging.debug('rechecking the same thing:')
logging.debug(user.tabs) # prints the list without the new value