Table of Contents

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

A resource that renders pages using DOM.

Base Classes   
Resource
View
Methods   
__init__
callback
dispatchResult
getNodeController
getNodeView
getTemplate
getTemplateMethods
handleDocument
handleFailures
handleNode
handleSuccesses
lookupTemplate
process
processNode
processString
processWidget
recurseChildren
render
sendPage
setTemplateMethods
setUp
  __init__ 
__init__ ( self,  model=None )

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

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

  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.

  getNodeController 
getNodeController (
        self,
        request,
        node,
        )

  getNodeView 
getNodeView (
        self,
        request,
        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.

  handleFailures 
handleFailures (
        self,
        request,
        failures,
        )

  handleNode 
handleNode (
        self,
        request,
        node,
        )

  handleSuccesses 
handleSuccesses (
        self,
        request,
        successes,
        )

  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.

  process 
process (
        self,
        request,
        **kwargs,
        )

  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 )

Check to see if handlers recorded any errors before sending the page

  setTemplateMethods 
setTemplateMethods ( self,  tm )

  setUp 
setUp (
        self,
        request,
        document,
        )


Table of Contents

This document was automatically generated on Sun Jul 14 19:53:39 2002 by HappyDoc version 2.0