# Class k.m.Model:

Part of kiwi.model View In Hierarchy

Known subclasses: kiwi.model.PickledModel

The Model is a mixin to be used by domain classes when attached to Proxies. It also provides autonotification of changes to the attached proxies. Note that if using setters, a specific call to notify_proxies() may be necessary; see the doc for __setattr__.

Method | __init__ | Undocumented
Method | ensure_init | Sets up the variables so the Model's getattr hook and proxy
Method | disable_autonotify | disable automatic notification to proxies based on __setattr__.
Method | notify_proxies | Notify proxies that an attribute value has changed.
Method | register_proxy_for_attribute | Attach a proxy to an attribute. The proxy will be notified of
Method | unregister_proxy_for_attribute | Detach a proxy from an attribute.
Method | unregister_proxy | Deattach a proxy completely from the model
Method | flush_proxies | Removes all proxies attached to Model
Method | block_proxy | Temporarily block a proxy from receiving any notification. See
Method | unblock_proxy | Re-enable notifications to a proxy
Method | __setattr__ | A special setattr hook that notifies the registered proxies that

def __init__(self):
overridden in kiwi.model.PickledModel
Undocumented
def ensure_init(self):
Sets up the variables so the Model's getattr hook and proxy notification work properly.

def disable_autonotify(self):
disable automatic notification to proxies based on __setattr__. All changes to the model must be followed by a call to notify_proxies() to allow the proxies to notice the change.

def notify_proxies(self, attr):
Notify proxies that an attribute value has changed.

def register_proxy_for_attribute(self, attr, proxy):
Attach a proxy to an attribute. The proxy will be notified of changes to that particular attribute (my means of Proxy.notify()).

def unregister_proxy_for_attribute(self, attr, proxy):
Detach a proxy from an attribute.

def unregister_proxy(self, proxy):
Deattach a proxy completely from the model

def flush_proxies(self):
Removes all proxies attached to Model

def block_proxy(self, proxy):
Temporarily block a proxy from receiving any notification. See unblock_proxy()

def unblock_proxy(self, proxy):
Re-enable notifications to a proxy

def __setattr__(self, attr, value):

A special setattr hook that notifies the registered proxies that the model has changed. Work around it setting attributes directly to self.__dict__.

Note that setattr() assumes that the name of the attribute being changed and the proxy attribute are the same. If this is not the case (as may happen when using setters) you must call notify_proxies() manually from the subclass' setter.