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

Class DOMTemplate

Resource --+
           |
          DOMTemplate


A resource that renders pages using DOM.
Method Summary
  __init__(self, templateFile)
  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.
  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.
  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.
  recurseChildren(self, request, node)
If this node has children, handle them.
  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)
    Inherited from Resource
  delEntity(self, name)
  getChild(self, path, request)
Retrieve a 'child' resource from me.
  getChildForRequest(self, request)
  getChildWithDefault(self, path, request)
Retrieve a static or dynamically generated child resource from me.
  getDynamicEntity(self, name, request)
  getStaticEntity(self, name)
  listDynamicEntities(self, request)
  listDynamicNames(self)
  listEntities(self)
  listNames(self)
  listStaticEntities(self)
  listStaticNames(self)
  putChild(self, path, child)
Register a static child.
  reallyPutEntity(self, name, entity)
  render_HEAD(self, request)
Default handling of HEAD method.

Class Variable Summary
tuple __implements__ = (<class twisted.web.resource.IResource ...
NoneType _cachedTemplate = None                                                                  
int isLeaf = 1                                                                     
str template = ''
str templateDirectory = ''
str templateFile = ''
    Inherited from Resource
NoneType server = None                                                                  

Method Details

__init__(self, templateFile=None)
(Constructor)

Parameters:
templateFile - The name of a file containing a template.
           (type=String)
Overrides:
twisted.web.resource.Resource.__init__

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. See IResource's render method.

I delegate to methods of self with the form 'render_METHOD' where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.

render_METHOD methods are expected to return a string which 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().

Old code that overrides render() directly is likewise expected to return a string or NOT_DONE_YET.
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 at 0x8450e44>,)                 

_cachedTemplate

Type:
NoneType
Value:
None                                                                  

isLeaf

Type:
int
Value:
1                                                                     

template

Type:
str
Value:
''                                                                     

templateDirectory

Type:
str
Value:
''                                                                     

templateFile

Type:
str
Value:
''                                                                     

Generated by Epydoc 2.0 on Sat May 15 20:08:13 2004 http://epydoc.sf.net