Package twisted :: Package web :: Package woven :: Module interfaces :: Class IModel

[show private | hide private]
[frames | no frames]

## Class IModel

    Interface --+
                |
               IModel

A MVC Model.

Method Summary
| ``addSubview`(view, subviewName)` Add a view for the model to keep track of.
| ``addView`(view)` Add a view for the model to keep track of.
| ``getData`(self)` Return the raw data contained by this Model object, if it is a wrapper.
| ``getSubmodel`(self, submodelName)` Return an IModel implementor for the submodel named "submodelName".
| ``lookupSubmodel`(self, submodelPath)` Return an IModel implementor for the given submodel path string.
| ``notify`(changed)` Notify all views that something was changed on me.
| ``removeView`(view)` Remove a view that the model no longer should keep track of.
| ``setData`(self, data)` Set the raw data referenced by this Model object, if it is a wrapper.
| ``setSubmodel`(self, submodelName, data)` Set the given data as a submodel of this model.

Method Details

### addSubview(view, subviewName)

Add a view for the model to keep track of. This model will only be notified if "subviewName"'s data has changed.

### addView(view)

Add a view for the model to keep track of.

### getData(self)

Return the raw data contained by this Model object, if it is a wrapper. If not, return self.

### getSubmodel(self, submodelName)

Return an IModel implementor for the submodel named "submodelName". If this object contains simple data types, they can be adapted to IModel using model.adaptToIModel(m, parent, name) before returning.

### lookupSubmodel(self, submodelPath)

Return an IModel implementor for the given submodel path string. This path may be any number of elements separated by /. The default implementation splits on "/" and calls getSubmodel until the path is exhausted. You will not normally need to override this behavior.

### notify(changed=None)

Notify all views that something was changed on me. Passing a dictionary of {'attribute': 'new value'} in changed will pass this dictionary to the view for increased performance. If you don't want to do this, don't, and just use the traditional MVC paradigm of querying the model for things you're interested in.

### removeView(view)

Remove a view that the model no longer should keep track of.

### setData(self, data)

Set the raw data referenced by this Model object, if it is a wrapper. This is done by telling our Parent model to setSubmodel the new data. If this object is not a wrapper, keep the data around and return it for subsequent getData calls.

### setSubmodel(self, submodelName, data)

Set the given data as a submodel of this model. The data need not implement IModel, since getSubmodel should adapt the data to IModel before returning it.

Generated by Epydoc 1.1 on Sat Feb 15 21:18:19 2003 | http://epydoc.sf.net