Home | Trees | Indices | Help |
|
---|
|
object --+ | Node
Instance Methods | |||
Node |
|
||
Node |
|
||
|
|||
str |
|
||
|
|||
|
|||
|
|||
iterable |
|
||
Node |
|
||
Node |
|
||
basestring |
|
||
Inherited from |
Static Methods | |||
Node |
|
Instance Variables | |
tuple |
ctx The node context (None if there isn't one). |
Properties | |
basestring or None |
content Node content |
bool |
hiddenelement Hidden node markup? |
bool |
closedelement Self-closed element? (read-only) |
RawNode |
raw Raw node |
Inherited from |
Method Details |
|
Determine direct subnodes by name In contrast to __getattr__ this works for all names. Also the exception in case of a failed lookup is different.
|
|
Set the attribute The value is encoded according to the model and the original case
of
|
name
|
Delete attribute If the attribute does not exist, no exception is raised.
|
Repeat the snippet len(list(itemlist)) times The actually supported signature is: repeat(self, callback, itemlist, *fixed, separate=None) Examples: def render_foo(self, node): def callback(node, item): ... node.repeat(callback, [1, 2, 3, 4]) def render_foo(self, node): def callback(node, item): ... def sep(node): ... node.repeat(callback, [1, 2, 3, 4], separate=sep) def render_foo(self, node): def callback(node, item, foo, bar): ... node.repeat(callback, [1, 2, 3, 4], "foo", "bar") def render_foo(self, node): def callback(node, item, foo, bar): ... def sep(node): ... node.repeat(callback, [1, 2, 3, 4], "foo", "bar", separate=sep)
|
Remove the node from the tree Tells the system, that the node (and all of its subnodes) should not be rendered. |
Iterate over repeated nodes Iteration works by repeating the original node len(list(iteritems)) times, turning the original node into a container node and appending the generated nodeset to that container. That way, the iterated nodes are virtually indented by one level, but the container node is completely hidden, so it won't be visible. All repeated nodes are marked as DONE, so they (and their subnodes) are not processed any further (except explicit callbacks). If there is a separator node assigned, it's put between the repetitions and not marked as DONE. The callbacks to them (if any) are executed when the template system gets back to control.
|
Replace the node (and all subnodes) with the copy of another one The replacement node is deep-copied, so use it with care (performance-wise). |
|
Render this node only and return the result as string Note that callback and params are optional positional parameters: render(self, decode=True, decode_errors='strict') # or render(self, callback, decode=True, decode_errors='strict') # or render(self, callback, param1, paramx, ... decode=True, ...) is also possible.
|
Instance Variable Details |
ctxThe node context (None if there isn't one). Node contexts are created on repetitions for all (direct and no-direct) subnodes of the repeated node. The context is a tuple, which contains for repeated nodes the position within the loop (starting with 0), the actual item and a tuple of the fixed parameters. The last two are also passed to the repeat callback function directly. For separator nodes, ctx[1] is a tuple containing the items before the separator and after it. Separator indices are starting with 0, too. |
Property Details |
contentNode content The property can be set to a unicode or str value, which will be escaped and encoded (in case of unicode). It replaces the content or child nodes of the node completely. The property can be read and will either return the raw content of the node (it may even contain markup) - or None if the node has subnodes.
|
hiddenelementHidden node markup?
|
closedelementSelf-closed element? (read-only)
|
rawRaw node
|
Home | Trees | Indices | Help |
|
---|