Package twisted :: Package web :: Module domhelpers

[frames | no frames]

## Module twisted.web.domhelpers

Classes
`RawText` | This is an evil and horrible speed hack.

Exceptions
`NodeLookupError` |

Function Summary
| ``_get`(node, nodeId, nodeAttrs)` (internal) Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes.
| ``clearNode`(node)` Remove all children from the given node.
| `findElements(parent, matcher)`
| `findElementsWithAttribute(parent, attribute, value)`
| `findElementsWithAttributeShallow(parent, attribute)`
| `findNodes(parent, matcher, accum)`
| `findNodesNamed(parent, name)`
| `findNodesShallow(parent, matcher, accum)`
| `findNodesShallowOnMatch(parent, matcher, recurseMatcher, accum)`
str | ``gatherTextNodes`(iNode, dounescape, joinWith)` Visit each child node and collect its text data, if any, into a string.
| ``get`(node, nodeId)` Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes.
| ``getAndClear`(node, nodeId)` Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes.
| ``getIfExists`(node, nodeId)` Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes.
| `getNodeText(node)`
| `getParents(node)`
| ``locateNodes`(nodeList, key, value, noNesting)` Find subnodes in the given node where the given attribute has the given value.
| ``namedChildren`(parent, nodeName)` namedChildren(parent, nodeName) -> children (not descendants) of parent that have tagName == nodeName
| ``substitute`(request, node, subs)` Look through the given node's children for strings, and attempt to do string substitution with the given parameter.
| `superAppendAttribute(node, key, value)`
| `superPrependAttribute(node, key, value)`
| `superSetAttribute(node, key, value)`
| `writeNodeData(node, oldio)`

Function Details

### _get(node, nodeId, nodeAttrs=('id', 'class', 'model', 'pattern'))

(internal) Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes.

### clearNode(node)

Remove all children from the given node.

### gatherTextNodes(iNode, dounescape=0, joinWith='')

Visit each child node and collect its text data, if any, into a string. For example:

       >>> doc=microdom.parseString('<a>1<b>2<c>3</c>4</b></a>')
       >>> gatherTextNodes(doc.documentElement)
       '1234'

With dounescape=1, also convert entities back into normal characters.

  Returns:
    the gathered nodes as a single string
    (type=str)

### get(node, nodeId)

Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes. If there is no such node, raise `NodeLookupError`.

### getAndClear(node, nodeId)

Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes. If there is no such node, raise `NodeLookupError`. Remove all child nodes before returning.

### getIfExists(node, nodeId)

Get a node with the specified `nodeId` as any of the `class`, `id` or `pattern` attributes. If there is no such node, return `None`.

### locateNodes(nodeList, key, value, noNesting=1)

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

### namedChildren(parent, nodeName)

namedChildren(parent, nodeName) -> children (not descendants) of parent that have tagName == nodeName

### substitute(request, node, subs)

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

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