Part of nevow.stan View Source View In Hierarchy
Known subclasses: nevow.stan.Comment
Implements interfaces: nevow.inevow.IQ
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 181 | Method | __init__ | Undocumented |
| 197 | Method | fillSlots | Remember the stan 'slotValue' with the name 'slotName' at this position |
| 207 | Method | patternGenerator | Returns a psudeo-Tag which will generate clones of matching |
| 226 | Method | allPatterns | Return a list of all matching pattern tags, cloned. |
| 237 | Method | onePattern | Return a single matching pattern, cloned. |
| 258 | Method | __call__ | Change attributes of this tag. This is implemented using |
| 316 | Method | __getitem__ | Add children to this tag. Multiple children may be added by |
| 341 | Method | __iter__ | Prevent an infinite loop if someone tries to do |
| 353 | Method | precompilable | Is this tag precompilable? |
| 377 | Method | clone | Return a clone of this tag. If deep is True, clone all of this |
| 408 | Method | clear | Clear any existing children from this tag. |
| 415 | Method | __repr__ | Undocumented |
| 425 | Method | freeze | Freeze this tag so that making future calls to __call__ or __getitem__ on the |
Returns a psudeo-Tag which will generate clones of matching pattern tags forever, looping around to the beginning when running out of unique matches.
If no matches are found, and default is None, raise an exception, otherwise, generate clones of default forever.
You can use the normal stan syntax on the return value.
Useful to find repeating pattern elements. Example rendering function:
>>> def simpleSequence(context, data):
... pattern = context.patternCloner('item')
... return [pattern(data=element) for element in data]
Return a list of all matching pattern tags, cloned.
Useful if you just want to insert them in the output in one place.
E.g. the sequence renderer's header and footer are found with this.Return a single matching pattern, cloned.
If there is more than one matching pattern or no matching patterns, raise an exception.
Useful in the case where you want to locate one and only one sub-tag and do something with it.table(width="100%", height="50%", border="1")
Attributes may be 'invisible' tag instances (so that
a(href=invisible(data="foo",
render=myhrefrenderer)) works), strings, functions, or any other
object which has a registered flattener.
If the attribute is a python keyword, such as 'class', you can add an underscore to the name, like 'class_'.
A few magic attributes have values other than these, as they are not serialized for output but rather have special purposes of their own:span(key="foo")[span(key="bar")] the
inner span actually has a key of 'foo.bar'. The key is intended for
use as e.g. an html 'id' attribute, but will is not automatically
output.
Add children to this tag. Multiple children may be added by passing a tuple or a list. Children may be other tag instances, strings, functions, or any other object which has a registered flatten.
This is implemented using __getitem__ because it then allows the natural syntax:
html[
head[
title["Hello World!"]
],
body[
"This is a page",
h3["How are you!"],
div(style="color: blue")["I hope you are fine."]
]
]
Is this tag precompilable?
Tags are precompilable if they will not be modified by a user render function.
Currently, the following attributes prevent the tag from being precompiled: