Package twisted :: Package web :: Package woven :: Module controller :: Class Controller

[show private | hide private]
[frames | no frames]

## Class Controller

    Collection --+
                 |
       Constrained --+
                     |
      ConfigCollection --+
                         |
                  Resource --+
                             |
                            Controller

Known Subclasses:
  `LiveController`, `InputHandler`, `Page`, `DOMController`

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 Summary
| `__init__(self, m, inputhandlers, view, controllers, templateDirectory)`
| `aggregateInvalid(self, request, input, data)`
| `aggregateValid(self, request, input, data)`
| ``delEntity`(self, name)` Remove a static reference for 'name'. (inherited from `Resource`)
| `domChanged(self, request, widget, node)`
| ``entityConstraint`(self, entity)` A method that determines whether an entity may be added to me. (inherited from `ConfigCollection`)
| `gatheredControllers(self, v, d, request)`
| ``getChild`(self, name, request)` Look for a factory method to create the object to handle the next segment of the URL.
| ``getChildForRequest`(self, request)` (internal) Get a child of mine dependant on a particular request. (inherited from `Resource`)
| ``getChildWithDefault`(self, path, request)` Retrieve a static or dynamically generated child resource from me. (inherited from `Resource`)
| ``getDynamicChild`(self, name, request)` This method is called when getChild cannot find a matching wchild_* method in the Controller.
| ``getDynamicEntity`(self, name, request)` Subclass this to generate an entity on demand. (inherited from `Resource`)
| ``getEntity`(self, name, request)` Retrieve an entity from me. (inherited from `Collection`)
| `getEntityType(self)` (inherited from `ConfigCollection`)
| `getNameType(self)` (inherited from `ConfigCollection`)
| ``getStaticEntity`(self, name)` Get an entity that was added to me using putEntity. (inherited from `Resource`)
| `getSubcontroller(self, request, node, model, controllerName)`
| ``handle`(self, request)` By default, we don't do anything
| `importControllerLibrary(self, namespace)`
| ``listDynamicEntities`(self, request)` A list of all name, entity that I can generate on demand. (inherited from `Resource`)
| ``listDynamicNames`(self)` Retrieve a list of the names of entities that I store references to. (inherited from `Resource`)
| `listEntities(self)` (inherited from `Resource`)
| `listNames(self)` (inherited from `Resource`)
| ``listStaticEntities`(self)` Retrieve a list of all name, entity pairs that I store references to. (inherited from `Resource`)
| ``listStaticNames`(self)` Retrieve a list of the names of entities that I store references to. (inherited from `Resource`)
| `makeView(self, model, templateFile, parentCount)`
| ``nameConstraint`(self, name)` A method that determines whether an entity may be added to me with a given name. (inherited from `Constrained`)
| ``pageRenderComplete`(self, request)` Override this to recieve notification when the view rendering process is complete.
| `process(self, request, **kwargs)`
| ``putChild`(self, path, child)` Register a static child. (inherited from `Resource`)
| ``putEntity`(self, name, entity)` Store an entity if it meets both constraints. (inherited from `Constrained`)
| `reallyPutEntity(self, name, entity)` (inherited from `Resource`)
| ``removeEntity`(self, name, request)` Remove an entity for 'name', based on the content of 'request'. (inherited from `Collection`)
| ``render`(self, request)` Trigger any inputhandlers that were passed in to this Page, then delegate to the View for traversing the DOM.
| `renderView(self, request)`
| `setNode(self, node)`
| `setSubcontrollerFactory(self, name, factory, setup)`
| `setSubmodel(self, submodel)`
| ``setUp`(self, request, *args)`
| `setupControllerStack(self)`
| `setView(self, view)`
| ``storeEntity`(self, name, request)` Store an entity for 'name', based on the content of 'request'. (inherited from `Collection`)
| ``wchild_index`(self, request)` By default, we return ourself as the index.

Class Variable Summary
`tuple` | `__implements__`
`int` | `addSlash`
`list` | `controllerLibraries`
`int` | `setupStacks`
`str` | `templateDirectory`
`NoneType` | `viewFactory`

Method Details

### getChild(self, name, request)

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.

  Parameters:
    `name` - The name of the child being requested.
    (type=string)
    `request` - The HTTP request being handled.
    (type=`twisted.web.server.Request`)

### getDynamicChild(self, name, request)

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.

  Parameters:
    `name` - The name of the child being requested.
    (type=string)
    `request` - The HTTP request being handled.
    (type=`twisted.web.server.Request`)

### handle(self, request)

By default, we don't do anything

### pageRenderComplete(self, request)

Override this to recieve notification when the view rendering process is complete.

### render(self, request)

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.

### setUp(self, request, *args)

  Parameters:
    `request`
    (type=`twisted.web.server.Request`)

### wchild_index(self, request)

By default, we return ourself as the index. Override this to provide different behavior for a URL that ends in a slash.

Class Variable Details

### __implements__

  Type:
    `tuple`
  Value:

        (<class 'twisted.web.woven.interfaces.IController'>,
         <class 'twisted.web.resource.IResource'>)

### addSlash

  Type:
    `int`
  Value:

        1

### controllerLibraries

  Type:
    `list`
  Value:

        []

### setupStacks

  Type:
    `int`
  Value:

        1

### templateDirectory

  Type:
    `str`
  Value:

        ''

### viewFactory

  Type:
    `NoneType`
  Value:

        None

Generated by Epydoc 1.1 on Thu May 8 13:17:01 2003 | http://epydoc.sf.net