twisted.web.woven.interfaces.IModel

Package twisted :: Package web :: Package woven :: Module interfaces :: Class IModel |
[frames | no frames]

## Class IModel

    Interface --+
                |
               IModel

A MVC Model.

Method Summary
| ``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, request, submodelName)` Return an IModel implementor for the submodel named "submodelName".
| ``lookupSubmodel`(self, request, 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, request, data)` Set the raw data referenced by this Model object, if it is a wrapper.
| ``setSubmodel`(self, request, submodelName, data)` Set the given data as a submodel of this model.

Method Details

### 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, request, 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, request, 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, request, 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, request, 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 2.0 on Sat May 15 20:08:34 2004 | http://epydoc.sf.net