Part of twisted.web.woven.interfaces View Source View In Hierarchy
Known implementations: twisted.web.woven.view.View
Method | __init__ | 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. |
Method | modelChanged | Dispatch changed messages to any update_* methods which may have been defined, then pass the update notification on to the controller. |
Method | controllerFactory | Hook for subclasses to customize the controller that is associated with the model associated with this view. |
Method | setController | Set the controller that this view is related to. |
Method | importViewLibrary | No summary |
Method | getSubview | 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". |
Method | setSubviewFactory | 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 | __adapt__ | Undocumented |
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.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.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