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 | Return a child with the given name for the given request. |
| Method | __init__ | A view must be told what its model is, and may be told what its |
| Method | setupAllStacks | Undocumented |
| Method | setUp | Undocumented |
| Method | setupViewStack | Undocumented |
| Method | importViewLibrary | Import the given object or module into this View's view namespace |
| Method | render | Render a request. This is called on the leaf resource for |
| Method | getTemplate | Override this if you want to have your subclass look up its template |
| Method | lookupTemplate | Use acquisition to look up the template named by self.templateFile, |
| Method | handleDocument | Handle the root node, and send the page if there are no |
| 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 |
| 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 |
| 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 |
| Method | getNodeController | Get a controller object to handle this node. If the node has no |
| 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 |
| Method | __setitem__ | Undocumented |
| Method | unlinkViews | Undocumented |
| Method | dispatchResultCallback | Deal with a callback from a deferred, checking to see if it is |
| 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