在Google App Engine中用Python获取扩展模型属性
我想知道怎么从一个扩展模型(expando model)中获取所有的属性,而不仅仅是用 Model.properties() 这个方法。
我想做的事情大概是这样的:
...
recs = query.fetch( 100 )
for rec in recs:
for name, value in rec.iteritem():
# figure out what, if any, expando properties are in this record
但是 Model.iteritem() 这个方法并不存在。
这看起来应该很简单,但我有点困惑。
谢谢!
1 个回答
2
rec.dynamic_properties() 会给你一个包含动态属性的列表
http://code.google.com/appengine/docs/python/datastore/modelclass.html#Model_dynamic_properties