Part of twisted.web.woven.view View Source View In Hierarchy
Known subclasses: twisted.web.woven.page.Page, twisted.web.woven.tapestry.TapestryView, twisted.web.woven.view.LiveView, twisted.web.woven.widgets.Widget
Implements interfaces: twisted.web.resource.IResource, twisted.web.woven.interfaces.IView
| Method | getChild | Undocumented |
| Method | getChildWithDefault | No summary |
| 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 | setupAllStacks | Undocumented |
| Method | setUp | Undocumented |
| Method | setupViewStack | Undocumented |
| Method | importViewLibrary | No summary |
| Method | render | No summary |
| Method | getTemplate | Override this if you want to have your subclass look up its template using a different method. |
| Method | lookupTemplate | No summary |
| Method | handleDocument | Handle the root node, and send the page if there are no outstanding callbacks when it returns. |
| Method | handleOutstanding | Undocumented |
| Method | recurseChildren | If this node has children, handle them. |
| Method | dispatchResult | Check a given result from handling a node and look up a NodeMutator adapter which will convert the result into a node and insert it into the DOM tree. Return the new node. |
| Method | modelChanged | Rerender this view, because our model has changed. |
| Method | generate | Allow a view to be used like a widget. Will look up the template file and return it in place of the incoming node. |
| Method | setController | Set the controller that this view is related to. |
| Method | setNode | Undocumented |
| Method | setSubmodel | Undocumented |
| Method | getNodeModel | Get the model object associated with this node. If this node has a model= attribute, call getSubmodel on the current model object. If not, return the top of the model stack. |
| Method | getNodeController | Get a controller object to handle this node. If the node has no controller= attribute, first check to see if there is an IController adapter for our model. |
| Method | getSubview | Get a sub-view from me. |
| Method | getNodeView | Undocumented |
| Method | handleNode | Undocumented |
| Method | handleControllerResults | Handle a deferred from a controller. |
| Method | handleNewNode | Undocumented |
| Method | sendPage | Check to see if handlers recorded any errors before sending the page |
| 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 | __setitem__ | Undocumented |
| Method | unlinkViews | Undocumented |
| Method | dispatchResultCallback | Deal with a callback from a deferred, checking to see if it is ok to send the page yet or not. |
| Method | renderFailure | Undocumented |
| Returns | widgets.Widget
| |
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