我需要在 App Engine 中支持计算属性。我下载了最新的源代码版本来尝试自己实现它们。在检查代码时,我遇到了一个似乎已经完全我需要的属性类。
class ComputedProperty(Property):
"""Property used for creating properties derived from other values.
Certain attributes should never be set by users but automatically
calculated at run-time from other values of the same entity. These
values are implemented as persistent properties because they provide
useful search keys.
...
"""
未记录的问题;我在官方文档中找不到有关 ComputedProperty
的任何信息。
ComputedProperty
是否可以安全使用,或者它是否存在错误或/并且可能会发生变化?
最佳答案
ComputedProperty
似乎是名为 DerivedProperty
from Nick Johnson's blog 的自定义属性类的“端口”(缺少更好的词) .
由于 Nick 的博客条目显示了创建自定义数据存储 Property
类是多么容易,所以我不会太担心 ComputedProperty
,因为您可以随时替换它如果需要,使用您自己的 Property
子类。
关于python - 使用 ComputedProperty 安全吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3541398/