Package twisted :: Package web :: Package woven :: Module template :: Class DOMTemplate |
[show private | hide private]
[frames | no frames]

## Class DOMTemplate

    Collection --+
                 |
       Constrained --+
                     |
      ConfigCollection --+
                         |
                  Resource --+
                             |
                            DOMTemplate

A resource that renders pages using DOM.

Method Summary
| ``__init__`(self, templateFile)`
| ``delEntity`(self, name)` Remove a static reference for 'name'. (inherited from `Resource`)
| ``dispatchResult`(self, request, node, result)` Check a given result from handling a node and hand it to a process* method which will convert the result into a node and insert it into the DOM tree.
| ``dispatchResultCallback`(self, result, request, node)` Deal with a callback from a deferred, dispatching the result and recursing children.
| ``entityConstraint`(self, entity)` A method that determines whether an entity may be added to me. (inherited from `ConfigCollection`)
| ``getChild`(self, path, request)` Retrieve a 'child' resource from me. (inherited from `Resource`)
| ``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`)
| ``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`)
| ``getTemplate`(self, request)` Override this if you want to have your subclass look up its template using a different method.
| ``handleDocument`(self, request, document)` Handle the root node, and send the page if there are no outstanding callbacks when it returns.
| ``handleNode`(self, request, node)` Handle a single node by looking up a method for it, calling the method and dispatching the result.
| ``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`)
| ``lookupTemplate`(self, request)` Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template.
| ``nameConstraint`(self, name)` A method that determines whether an entity may be added to me with a given name. (inherited from `Constrained`)
| ``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`)
| ``recurseChildren`(self, request, node)` If this node has children, handle them.
| ``removeEntity`(self, name, request)` Remove an entity for 'name', based on the content of 'request'. (inherited from `Collection`)
| ``render`(self, request)` Render a given resource.
| `renderFailure(self, failure, request)`
| ``sendPage`(self, request)` Send the results of the DOM mutation to the browser.
| `setUp(self, request, document)`
| ``storeEntity`(self, name, request)` Store an entity for 'name', based on the content of 'request'. (inherited from `Collection`)

Class Variable Summary
`tuple` | `__implements__`
`int` | `isLeaf`
`str` | `template`
`str` | `templateDirectory`
`str` | `templateFile`
`NoneType` | `_cachedTemplate`

Method Details

### __init__(self, templateFile=None) (Constructor) Parameters: `templateFile` - The name of a file containing a template. (type=String)

### dispatchResult(self, request, node, result) Check a given result from handling a node and hand it to a process* method which will convert the result into a node and insert it into the DOM tree. Return the new node.

### dispatchResultCallback(self, result, request, node) Deal with a callback from a deferred, dispatching the result and recursing children.

### getTemplate(self, request) Override this if you want to have your subclass look up its template using a different method.

### handleDocument(self, request, document) Handle the root node, and send the page if there are no outstanding callbacks when it returns.

### handleNode(self, request, node) Handle a single node by looking up a method for it, calling the method and dispatching the result. Also, handle all childNodes of this node using recursion.

### lookupTemplate(self, request) Use acquisition to look up the template named by self.templateFile, located anywhere above this object in the heirarchy, and use it as the template. The first time the template is used it is cached for speed.

### recurseChildren(self, request, node) If this node has children, handle them.

### render(self, request) Render a given resource. This must be implemented in all subclasses of Resource. The return value of this method will be the rendered page, unless the return value is twisted.web.server.NOT_DONE_YET, in which case it is this class's responsibility to write the results to request.write(data), then call request.finish(). Overrides: `twisted.web.resource.Resource.render` (inherited documentation)

### sendPage(self, request) Send the results of the DOM mutation to the browser.

Class Variable Details

    ### __implements__ Type: `tuple` Value:
        (<class 'twisted.web.resource.IResource'>,
         <class 'twisted.coil.coil.IConfigCollection'>)

    ### isLeaf Type: `int` Value:
        1

    ### template Type: `str` Value:
        ''

    ### templateDirectory Type: `str` Value:
        ''

    ### templateFile Type: `str` Value:
        ''

    ### _cachedTemplate Type: `NoneType` Value:
        None

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