t.w.w.i.IController(Interface) : interface documentation

Part of twisted.web.woven.interfaces View Source View In Hierarchy

Known implementations: twisted.web.woven.controller.Controller

A MVC Controller
Method setView Set the view that this controller is related to.
Method importControllerLibrary No summary
Method getSubcontroller 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".
Method setSubcontrollerFactory 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.
Method __adapt__ Undocumented
def setView(view): (source)
Set the view that this controller is related to.
def importControllerLibrary(moduleOrObject): (source)
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.
def getSubcontroller(request, node, model, controllerName): (source)

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.
def setSubcontrollerFactory(name, factory): (source)

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.
def __adapt__(adaptable, default): (source)
Undocumented
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:02:37.