2010-08-22 85 views
4

我需要支持App Engine中的計算屬性。我下載了最新的源代碼版本,以便自己嘗試並實施它們。雖然通過代碼,我碰到一個財產類,似乎正好我所需要的。使用ComputedProperty安全嗎?

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是否安全使用,或者它是越野車或/和可能會改變?

回答

7

ComputedProperty似乎是名爲DerivedProperty from Nick Johnson's blog的自定義屬性類的「端口」(缺少更好的單詞)。

由於尼克的博客文章顯示它可以如何輕鬆地創建自定義的數據存儲Property類,我也不太擔心ComputedProperty,你可以用Property子自己的如果需要的話隨時更換它。