[Twisted-web] How to nest LiveElements? (getting a
iacovou at gmail.com
Fri Dec 1 08:49:49 CST 2006
On Friday 01 December 2006 16:20, Jean-Paul Calderone wrote:
> On Fri, 1 Dec 2006 15:35:34 +0200, kgi <iacovou at gmail.com> wrote:
> All Element renderers _must_ use renderer(). All Fragment/Page renderers
> _must_ use the "render_" prefix. All Athena callables _must_ use expose().
> No other approach will work at all.
Hi JP; thanks for your reply. That has got it working!
Can I ask, what's the high-level, hand-wavey, fuzzy-feeling distinction
between a Page and an Element?
I just think of them both as "things in which I define a docFactory and which
magically render themselves", which is why I hit this problem: I had assumed
that whichever I should use should be applicable to both Pages and Elements,
since in both cases I was defining stan in a docFactory.
I had tried various combinations of using ("render_"|renderer()) and returning
(ctx.tag[elem]|elem), but it never occurred to me to use different syntax for
Pages and Elements.
> > from nevow.page import renderer
> > def innerWidget ( self, request, tag ):
> > ...
> > return elem
> > renderer(innerWidget)
> Like the other examples, you could return ctx.tag[elem] here.
Do you mean, tag[elem], since these render methods receive (request,tag)
rather than (ctx,data)?
More information about the Twisted-web