데이터 저장소 개체에 동적으로 추가 된 세션의 특성을 검색 할 수 없습니다. 여기에 (단순화 된) 예제가 있습니다 ... 제안에 시간을 절약하기 위해 실제로 데이터 저장소 객체에 속성을 하드 코딩하고 싶지는 않습니다.데이터 저장소 개체에 (동적으로) 특성을 추가하고 세션에 저장할 수없는 이유는 무엇입니까?
Class User(ndb.Model):
email = ndb.String...
// I use a handler to get the user object from the datastore
// and store the object in session
user = function_to_get_user_by_key(key)
// Add an temporary attribute
user.temp_var = 'test'
// Store in session
self.session['user'] = user
// Get the user in the same script to test the attribute
user = self.session.get('user')
print user.temp_var // Works - I see the result
// Redirect to a new script (By the way, assume these scripts are in separate methods within a handler class)
user = self.session.get('user')
print user.temp_var // Gives an attribute error - basically saying the class does not have this attribute
왜 이런 일이 발생하는지 알고 싶습니다.