[Twisted-web] Re: rendering sub-Pages in nevow (probable bug)

Alex Levy mesozoic at polynode.com
Mon May 3 13:15:30 MDT 2004

On Mon, 2004-05-03 at 09:18, Federico Di Gregorio wrote:
> Hi *,
> I am using nevow 0.1 so if this has been fixed/is a know problem just
> redirect me to the right resource.
> Apparently it is possible to serve a Page instance from a render_XXX
> method if it is implemented as a rend.stan docFactory but not if it
> tries to load a template from disk (rend.htmlfile). i.e., the following
> code (add some imports, etc.) works [...]

Nevow 0.1 is very _very_ outdated. I'd recommend using SVN trunk
instead, and if you want stability, just don't update unless you
encounter bugs (like now :)

Being able to return pages from render_ methods is (should be) fully
supported in SVN trunk. 

You can even go a step further and denote a specific part of the doc
factory which should be used for this:

class SomePage(rend.Page):
    docFactory = rend.htmlstr('''
        <div nevow:pattern="content">Content</div>

If this object is rendered as a page, the header will show up. But if
you return it from a render_ method, then only the div with the
"content" pattern (and everything inside it) will be used. So you can
create pages with all the necessary fluff around the edges, but avoid
rendering the "skin" (headers, navbars, what have you) multiple times.

Alex Levy
WWW: http://mesozoic.geecs.org/

"Never let your sense of morals prevent you from doing what is right."
-- Salvor Hardin, Isaac Asimov's _Foundation_
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040503/e42cd9d8/attachment.bin

More information about the Twisted-web mailing list