t.w.w.c.Controller(resource.Resource) : class documentation

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

Known subclasses: twisted.web.woven.controller.LiveController, twisted.web.woven.input.InputHandler, twisted.web.woven.page.Page, twisted.web.woven.template.DOMController

Implements interfaces: twisted.web.woven.interfaces.IController

A Controller which handles to events from the user. Such events are `web request', `form submit', etc.

I should be the IResource implementor for your Models (and registerControllerForModel makes this so).
Method __init__ Initialize.
Method setupControllerStack Undocumented
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 setView Set the view that this controller is related to.
Method setNode Undocumented
Method setUp
Method getChild No summary
Method getDynamicChild No summary
Method wchild_index By default, we return ourself as the index. Override this to provide different behavior for a URL that ends in a slash.
Method render No summary
Method makeView Undocumented
Method renderView Undocumented
Method gatheredControllers Undocumented
Method aggregateValid Undocumented
Method aggregateInvalid Undocumented
Method process Undocumented
Method setSubmodel Undocumented
Method handle By default, we don't do anything
Method exit We are done handling the node to which this controller was attached.
Method domChanged Undocumented
Method pageRenderComplete Override this to recieve notification when the view rendering process is complete.

Inherited from Resource:

Method listStaticNames Undocumented
Method listStaticEntities Undocumented
Method listNames Undocumented
Method listEntities Undocumented
Method listDynamicNames Undocumented
Method listDynamicEntities Undocumented
Method getStaticEntity Undocumented
Method getDynamicEntity Undocumented
Method delEntity Undocumented
Method reallyPutEntity Undocumented
Method getChildWithDefault Retrieve a static or dynamically generated child resource from me.
Method getChildForRequest Undocumented
Method putChild Register a static child.
Method render_HEAD Default handling of HEAD method.
def __init__(self, m, inputhandlers=None, view=None, controllers=None, templateDirectory=None): (source)
Initialize.
def setupControllerStack(self): (source)
Undocumented
def importControllerLibrary(self, namespace): (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(self, 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(self, name, factory, setup=None): (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 setView(self, view): (source)
Set the view that this controller is related to.
def setNode(self, node): (source)
Undocumented
def setUp(self, request, *args): (source)
Parametersrequest (type: twisted.web.server.Request )
def getChild(self, name, request): (source)
Look for a factory method to create the object to handle the next segment of the URL. If a wchild_* method is found, it will be called to produce the Resource object to handle the next segment of the path. If a wchild_* method is not found, getDynamicChild will be called with the name and request.
ParametersnameThe name of the child being requested. (type: string )
requestThe HTTP request being handled. (type: twisted.web.server.Request )
def getDynamicChild(self, name, request): (source)
This method is called when getChild cannot find a matching wchild_* method in the Controller. Override me if you wish to have dynamic handling of child pages. Should return a Resource if appropriate. Return None to indicate no resource found.
ParametersnameThe name of the child being requested. (type: string )
requestThe HTTP request being handled. (type: twisted.web.server.Request )
def wchild_index(self, request): (source)
By default, we return ourself as the index. Override this to provide different behavior for a URL that ends in a slash.
def render(self, request): (source)
Trigger any inputhandlers that were passed in to this Page, then delegate to the View for traversing the DOM. Finally, call gatheredControllers to deal with any InputHandlers that were constructed from any controller= tags in the DOM. gatheredControllers will render the page to the browser when it is done.
def makeView(self, model, templateFile=None, parentCount=0): (source)
Undocumented
def renderView(self, request): (source)
Undocumented
def gatheredControllers(self, v, d, request): (source)
Undocumented
def aggregateValid(self, request, input, data): (source)
Undocumented
def aggregateInvalid(self, request, input, data): (source)
Undocumented
def process(self, request, **kwargs): (source)
Undocumented
def setSubmodel(self, submodel): (source)
Undocumented
def handle(self, request): (source)
By default, we don't do anything
def exit(self, request): (source)
We are done handling the node to which this controller was attached.
def domChanged(self, request, widget, node): (source)
Undocumented
def pageRenderComplete(self, request): (source)
Override this to recieve notification when the view rendering process is complete.
API Documentation for Twisted, generated by pydoctor at 2011-10-27 15:57:47.