我想我疯了,为什么下面的工作不起作用?在
class Parent(db.Model):
childrenKeys = db.ListProperty(str,indexed=False,default=None)
p = Parent.get_or_insert(key_name='somekey')
p.childrenKeys = p.childrenKeys.append('newchildkey')
p.put()
我得到这个错误:
^{pr2}$医生说:
default is the default value for the list property. If None, the default is an empty list. A list property can define a custom validator to disallow the empty list.
所以在我看来,我得到了默认值(一个空列表),并向它附加一个新值,然后保存它。在
您应该删除
p.childrenKeys
赋值:替换此项:
有了这个:
^{pr2}$append()
返回None
,它不能分配给p.childrenKeys
。在相关问题 更多 >
编程相关推荐