2012-04-24 5 views
0

생성 된 비 -ndb 엔터티와이 개체를 소유 한 webapp2 사용자가 있습니다. 키를 인스턴스 변수로 유지할 수 있습니까? 나는 예외가이 일을하려고 얻을 :사용자가 ndb.expando 인 경우 소유권을 나타내는 방법

'Ad' object has no attribute '_values' 
Traceback (most recent call last): 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__ 
    rv = self.handle_exception(request, response, e) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__ 
    rv = self.router.dispatch(request, response) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher 
    return route.handler_adapter(request, response) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__ 
    return handler.dispatch() 
    File "/base/data/home/apps/s~montaoproject/sessions.358423846858516313/authhandlers.py", line 21, in dispatch 
    webapp2.RequestHandler.dispatch(self) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch 
    return self.handle_exception(e, self.app.debug) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch 
    return method(*args, **kwargs) 
    File "/base/data/home/apps/s~montaoproject/sessions.358423846858516313/main.py", line 3004, in post 
    ad.usr = self.current_user.key 
    File "/base/data/home/apps/s~montaoproject/sessions.358423846858516313/ndb/model.py", line 1039, in __set__ 
    self._set_value(entity, value) 
    File "/base/data/home/apps/s~montaoproject/sessions.358423846858516313/ndb/model.py", line 801, in _set_value 
    self._store_value(entity, value) 
    File "/base/data/home/apps/s~montaoproject/sessions.358423846858516313/ndb/model.py", line 785, in _store_value 
    entity._values[self._name] = value 
AttributeError: 'Ad' object has no attribute '_values' 

기분을 상하게하는 코드

if self.current_user: 
    logging.info('user:'+str(self.current_user)) 
    ad.usr = self.current_user.key 
    ad.put 

모델

class Ad(GeoModel, search.SearchableModel): 

    primary_image = blobstore.BlobReferenceProperty() 
    usr = ndb_model.KeyProperty() 
    ... 

내가 할 노력하고있어 할 수있는 권장 방법이 있나요?

감사합니다.

답변

관련 문제