Home | Trees | Index | Help |
|
---|
Package twisted :: Package web :: Package woven :: Module interfaces :: Class IView |
|
Interface
--+
|
IView
Method Summary | |
---|---|
A view must be told what its model is, and may be told what its controller is, but can also look up its controller if none specified. | |
__adapt__(adaptable,
default)
| |
Hook for subclasses to customize the controller that is associated with the model associated with this view. | |
Look for a view named "viewName" to handle the node "node". | |
Import the given object or module into this View's view namespace stack. | |
Dispatch changed messages to any update_* methods which may have been defined, then pass the update notification on to the controller. | |
Set the controller that this view is related to. | |
Set the callable "factory", which takes a model and should return a Widget, to be called by the default implementation of getSubview when the viewName "name" is present in the template. |
Method Details |
---|
__init__(model,
controller=None)
A view must be told what its model is, and may be told what its
controller is, but can also look up its controller if none
specified.
|
controllerFactory()Hook for subclasses to customize the controller that is associated with the model associated with this view. Default behavior: Look up a component that implements IController for the self.model instance. |
getSubview(request, node, model, viewName)Look for a view named "viewName" to handle the node "node". When a node <div view="foo" /> is present in the template, this method will be called with viewName set to "foo". Return None if this View doesn't want to provide a Subview for the given name. |
importViewLibrary(moduleOrObject)Import the given object or module into this View's view namespace stack. If the given object or module has a getSubview function or method, it will be called when a node has a view="foo" attribute. If no getSubview method is defined, a default one will be provided which looks for the literal name in the namespace. |
modelChanged(changed)Dispatch changed messages to any update_* methods which may have been defined, then pass the update notification on to the controller. |
setController(controller)Set the controller that this view is related to. |
setSubviewFactory(self, name, factory, setup=None)Set the callable "factory", which takes a model and should return a Widget, to be called by the default implementation of getSubview when the viewName "name" is present in the template. This would generally be used like this: view.setSubviewFactory("foo", MyFancyWidgetClass) This is equivalent to:def wvfactory_foo(self, request, node, m): return MyFancyWidgetClass(m) Which will cause an instance of MyFancyWidgetClass to be instanciated when template node <div view="foo" /> is encountered. If setup is passed, it will be passed to new instances returned from this factory as a setup method. The setup method is called each time the Widget is generated. Setup methods take (request, widget, model) as arguments. This is equivalent to:def wvupdate_foo(self, request, widget, model): # whatever you want |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Sat May 15 20:08:05 2004 | http://epydoc.sf.net |