Part of twisted.web.template View Source View In Hierarchy
Implements interfaces: twisted.web.iweb.IRenderable
Base for classes which can render part of a page.
An Element is a renderer that can be embedded in a stan document and can hook its template (from the loader) up to render methods.
An Element might be used to encapsulate the rendering of a complex piece of data which is to be displayed in multiple different contexts. The Element allows the rendering logic to be easily re-used in different ways.
Element returns render methods which are registered usingtwisted.web.element.renderer
. For example:
class Menu(Element): @renderer def items(self, request, tag): ....Render methods are invoked with two arguments: first, the
twisted.web.http.Request
being served and second, the tag object which "invoked" the
render method.
Instance Variables | loader | The factory which will be used to load documents to return from
render .
(type: ITemplateLoader
provider
) |
Method | __init__ | Undocumented |
Method | lookupRenderMethod | Look up and return the named render method. |
Method | render | Implement IRenderable to
allow one Element to be
embedded in another's template or rendering output.
|
Implement IRenderable
to
allow one Element
to be
embedded in another's template or rendering output.
loader
; when
used in a template, the flattening engine will keep track of this object
separately as the object to lookup renderers on and call
Element.renderer
to look them up. The resulting object from
this method is not directly associated with this Element
.)