def getCustomProperties(self):
props = {}
# list of property names that are considered read only
read_only_props = []
repeated_props = {}
non_repeated_props = {}
# list of property names that are computed
computed_props = {}
for name, prop in self.klass._properties.iteritems():
props[name] = prop
if prop._repeated:
repeated_props[name] = prop
else:
non_repeated_props[name] = prop
if isinstance(prop, ndb.ComputedProperty):
computed_props[name] = prop
if issubclass(self.klass, polymodel.PolyModel):
del props['class']
# check if the property is a defined as a computed property. These
# types of properties are read-only
for name, value in self.klass.__dict__.iteritems():
if isinstance(value, ndb.ComputedProperty):
read_only_props.append(name)
self.encodable_properties.update(props.keys())
self.decodable_properties.update(props.keys())
self.readonly_attrs.update(read_only_props)
if computed_props:
self.decodable_properties.difference_update(computed_props.keys())
self.model_properties = props or None
self.repeated_properties = repeated_props or None
self.non_repeated_properties = non_repeated_props or None
self.computed_properties = computed_props or None
_google_appengine_ext_ndb.py 文件源码
python
阅读 15
收藏 0
点赞 0
评论 0
评论列表
文章目录