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

## Class IController

    Interface --+
                |
               IController

A MVC Controller

Method Summary
| `__adapt__(adaptable, default)`
| ``getSubcontroller`(request, node, model, controllerName)` Look for a controller named "controllerName" to handle the node "node".
| ``importControllerLibrary`(moduleOrObject)` Import the given object or module into this Controllers's controller namespace stack.
| ``setSubcontrollerFactory`(self, name, factory)` Set the callable "factory", which takes a model and should return an InputHandler, to be called by the default implementation of getSubview when the controllerName "name" is present in the template.
| ``setView`(view)` Set the view that this controller is related to.

Method Details

### getSubcontroller(request, node, model, controllerName) Look for a controller named "controllerName" to handle the node "node". When a node <div controller="foo" /> is present in the template, this method will be called with controllerName set to "foo". Return None if this Controller doesn't want to provide a Subcontroller for the given name.

### importControllerLibrary(moduleOrObject) Import the given object or module into this Controllers's controller namespace stack. If the given object or module has a getSubcontroller function or method, it will be called when a node has a controller="foo" attribute. If no getSubcontroller method is defined, a default one will be provided which looks for the literal name in the namespace.

### setSubcontrollerFactory(self, name, factory) Set the callable "factory", which takes a model and should return an InputHandler, to be called by the default implementation of getSubview when the controllerName "name" is present in the template. This would generally be used like this:
       view.setSubcontrollerFactory("foo", MyFancyInputHandlerClass)
This is equivalent to:
       def wcfactory_foo(self, request, node, m):
           return MyFancyInputHandlerClass(m)
Which will cause an instance of MyFancyInputHandlerClass to be instanciated when template node <div controller="foo" /> is encountered.

### setView(view) Set the view that this controller is related to.

Generated by Epydoc 2.0 on Sat Oct 25 00:55:10 2003 | http://epydoc.sf.net