Package Products :: Package ZenUtils :: Module observable :: Class IObservable
[hide private]
[frames] | no frames]

Class IObservable

source code

zope.interface.Interface --+
                           |
                          IObservable

Classes that implement the IObservable interface agree to provide the Observer pattern for object attribute changes.

Instance Methods [hide private]
 
attachAttributeObserver(self, name, observer)
Attaches an observer that will be notified when the specified attribute changes value.
source code
 
detachAttributeObserver(self, name, observer)
Removes an observer from watching the specified attribute.
source code
 
notifyAttributeChange(self, name, oldValue, newValue)
Notify all registered observers that an attribute has changed value.
source code
Method Details [hide private]

attachAttributeObserver(self, name, observer)

source code 

Attaches an observer that will be notified when the specified attribute changes value.

@param name the attribute name to observer @param observer the observer/listener to be notified @type observer callable

detachAttributeObserver(self, name, observer)

source code 

Removes an observer from watching the specified attribute.

@param name the attribute name to remove the observer from @param observer the observer/listener to be removed

notifyAttributeChange(self, name, oldValue, newValue)

source code 

Notify all registered observers that an attribute has changed value.
Register observers must be a Python callable and will receive the 
following keyword arguments:
    observerable - a reference to the observed object
    attrName - the attribute name that has changed
    oldValue - the previous value
    newValue - the new value
    
@param name the attribute name that has changed
@param oldValue the old attribute value
@param newValue the new attribute value