[Twisted-web] fragments with child lookup

L. Daniel Burr ldanielburr at mac.com
Mon Sep 25 12:49:09 CDT 2006


Hi Markus,


On Mon, 25 Sep 2006 12:24:43 -0500, Markus Schiltknecht  
<markus at bluegap.ch> wrote:

[snip code implementing Markus' URL-component-rendering scheme]

> Imagine all the possibilities this opens: you could for example write a  
> Container which holds multiple pastebins for different categories.  
> Having a template surrounding the original pastebin and offering to jump  
> between the categories. All with just a simple ContainerPage with all  
> the comfort of nevow (docFactories, children, renderers, etc...). If you  
> don't hard code the boring pastebin example, but make it dynamically  
> configurable, you can wrap whatever component you want. You have a  
> category chooser which can be applied to any other component. That's  
> what I call 'component based'!
>

For an example of how awful this kind of design strategy is, please Google
for anything involving Zope Acquisition.  It ends up as a nightmare of
complexity, and the Zope guys got rid of it after a lot of painful  
real-world
experience.

> And writing a ContainerPage is as simple as giving it a docFactory which  
> renders 'child_content', adding some children and adding a  
> defaultChildPage!
>

I agree the concept is simple, and I understand why so many people find it
tempting.  This is why we have WSGI (another bad idea IMO), and various
implementations of "render each URL segment as a child of another segment".

Again, I think this is terrible.  All you've done is inflict the hell of
an arbitrary number of server-side includes into the rendering process.

> Anybody else out here seeing the benefits of that?
>

I'm sorry, but I don't, and I feel very strongly that attempts to provide
this kind of rendering strategy within nevow are misguided.  Twisted does
provide WSGI support, via web2; please consider implementing this as some
kind of WSGI rendering component, so that you can leverage the behavior
you desire without promoting this style of coding within nevow itself.

L. Daniel Burr



More information about the Twisted-web mailing list