class Thread(db.Model):
members = db.StringListProperty()
def user_is_member(self, user):
return str(user) in self.members
和GAE錯誤:AttributeError的: 'NoneType' 對象有沒有屬性 'user_is_member'
thread = Thread.get(db.Key.from_path('Thread', int(id)))
is_member = thread.user_is_member(user)
但錯誤是:
Traceback (most recent call last):
File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__
handler.get(*groups)
File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 62, in check_login
handler_method(self, *args)
File "D:\zjm_code\forum_blog_gae\main.py", line 222, in get
is_member = thread.user_is_member(user)
AttributeError: 'NoneType' object has no attribute 'user_is_member'
爲什麼呢?
感謝
貌似db.Key.from_path(「線」,INT (id))不會創建有效的密鑰。 – systempuntoout 2010-05-07 09:24:16