[PEAK] Overriding getter/setter of a model
Phillip J. Eby
pje at telecommunity.com
Wed Jul 27 11:32:52 EDT 2005
At 03:02 PM 7/27/2005 +0000, Tiago Cogumbreiro wrote:
>Is there any way to override the setter/getter of a model's field?
If all you want is to be notified of a change, you should define _onLink
and _onUnlink methods in the attribute class body.
If you want to override the getter to create a computed or derived field,
you should set 'isDerived = True' and then define a 'get(feature,element)'
method; see peak.model.features starting at line 292 for examples of 'get'
By default, derived fields are not changeable, unless you also define a
set(feature,element,value) method, and explicitly set isChangeable to True.
More information about the PEAK