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

Federico Di Gregorio fog at initd.org
Mon May 3 16:48:00 MDT 2004


Lì lunedì, 2004/05/03 alle 15:15, -0400, Alex Levy ha scritto:
> 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 :)

using trunk and branches/freeform-patterned (after irc session with
fzZzy) right now.

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

it is not; here are the problems:

	trunk:
		stan     -> works as expected
		htmlfile -> infinite recursion
		xmlfile  -> no error but does not render
                            (template copied 'as is' to output)
	branch:
		stan     -> works as expected
		htmlfile -> works as expected
		xmlfile  -> no error but does not render
                            (template copied 'as is' to output)

i can check the other loader if needed. a test case is on the way.

> 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('''
>       <html><body>
>         <h1>Header</h1>
>         <div nevow:pattern="content">Content</div>
>       </body></html>
>     ''')
> 
> 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.

I don't find this much usefull, sorry. what we really need in a real
use-case (on your browser in 15 days and GPL'ed after that :) is
sub-template rendering. luckily enough loaders.htmlfile is working. hope
to see that in trunk (and maybe a working xmlfile too) soon.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                fog at debian.org
INIT.D Developer                                           fog at initd.org
  We are all dust, Saqi, so play the lute
                    We are all wind, Saqi, so bring wine. -- Omar Khayam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Questa parte del messaggio =?ISO-8859-1?Q?=E8?= firmata
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040504/f216e2f6/attachment.bin


More information about the Twisted-web mailing list