Table of Contents

Class: DOMTemplate Twisted-0.18.0/twisted/web/domtemplate.py

A resource that renders pages using DOM.

Base Classes   
Resource
Methods   
__init__
callback
controllerFactory
dispatchResult
getTemplate
getTemplateMethods
handleDocument
handleNode
locateNodes
lookupTemplate
processNode
processString
processWidget
recurseChildren
render
sendPage
setTemplateMethods
substitute
  __init__ 
__init__ ( self,  model=None )

  callback 
callback (
        self,
        result,
        request,
        node,
        )

Deal with a callback from a deferred, dispatching the result and recursing children.

  controllerFactory 
controllerFactory (
        self,
        model,
        view,
        )

Override this if you want a controller to be instanciated when a form is submitted.

  dispatchResult 
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.

  getTemplate 
getTemplate ( self,  request )

Override this if you want to have your subclass look up it's template using a different method.

  getTemplateMethods 
getTemplateMethods ( self )

Override this to return a list of dictionaries specifying the tag attributes to associate with a method.

  1. g. to call the foo method each time a tag with the class bar is encountered, use a dictionary like this:

{'class': bar, 'method': self.foo}

To call the "destroy" method each time the tag, class, or id "blink" is encountered, use a dictionary like this:

{'class': blink, 'id': blink, 'tag': blink, 'method': self.destroy}

  handleDocument 
handleDocument (
        self,
        request,
        document,
        )

Handle the root node, and send the page if there are no outstanding callbacks when it returns.

  handleNode 
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.

  locateNodes 
locateNodes (
        self,
        nodeList,
        key,
        value,
        )

Find subnodes in the given node where the given attribute has the given value.

  lookupTemplate 
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.

  processNode 
processNode (
        self,
        request,
        newnode,
        oldnode,
        )

  processString 
processString (
        self,
        request,
        html,
        node,
        )

  processWidget 
processWidget (
        self,
        request,
        widget,
        node,
        )

Render a widget, and insert it in the current node.

  recurseChildren 
recurseChildren (
        self,
        request,
        node,
        )

If this node has children, handle them.

  render 
render ( self,  request )

Exceptions   
AttributeError, "%s does not define self.templateFile to operate on" % self.__class__
  sendPage 
sendPage ( self,  request )

Convert the DOM tree to XML and send it to the browser.

  setTemplateMethods 
setTemplateMethods ( self,  tm )

  substitute 
substitute (
        self,
        request,
        node,
        subs,
        )

Look through the given node's children for strings, and attempt to do string substitution with the given parameter.


Table of Contents

This document was automatically generated on Sat Jun 1 22:29:42 2002 by HappyDoc version 2.0