[Twisted-web] fragments with child lookup

Markus Schiltknecht markus at bluegap.ch
Thu Sep 21 11:30:36 CDT 2006


sorry, I forgot to mention: I'm using twisted 2.4.0 / nevow 0.9 (or svn 
trunk, not sure).



Markus Schiltknecht wrote:
> Hi,
> I would like to use the child lookup mechanism (locateChild or 
> childFactory) but then again, I want Fragments. I'm sure there is a 
> proper way to do what I want. Let my try to explain with a URL mapping 
> to templates mapping:
> /           ->     common.xml
> /foo        ->     common.xml / foo.xml
> /bar        ->     common.xml / bar.xml
> /bar/baz    ->     common.xml / bar.xml / baz.xml
> common.xml as well as bar.xml both have a 'sub-content' renderer, which 
> calls the next template. Of course this all happens dynamically.
> I've tried two things:
> a) make locateChild always return self, () and save which child it 
> contains (and which it has to return as it's 'sub-content'. 
> Unfortunately that stops the children lookup and I would have to invoke 
> it locateChild of the child with segments[1:] myself. That seems ugly.
> b) make locateChild return the real Child. That seems the right thing to 
> do. But then I only get the latest child's template (i.e. baz.xml when 
> calling the URL '/bar/baz' in the example above). How do I make that 
> latest child render it's parents first?
> Regards
> Markus
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

More information about the Twisted-web mailing list