[Twisted-web] fragments with child lookup

Valentino Volonghi aka Dialtone dialtone at divmod.com
Mon Sep 25 12:59:26 CDT 2006


On Mon, 25 Sep 2006 19:24:43 +0200, Markus Schiltknecht <markus at bluegap.ch> wrote:
>IMHO, the designer should not have to care about level of nested-ness of his 
>templates.

In fact I've been telling you how this was wrong.

>>macros are a much better way to integrate a pre-existing template into a 
>>basic template. They work at TEMPLATE level not at Page or Fragment level.
>
>..and that's the problem: working at the template level is not sufficient 
>for my application.

You first have to tell me *why*.

>Why should that not work? What about WSGI as a simple API? There are 
>systems, that use WSGI to pass 'requests' around, processing parts of it 
>(i.e. segments, in nevow terms).

You completely failed to understand the problem here... Do you realize that
usually web applications are not just static pages that you can put here and
there right? You have an abstraction to reach the data source, another one
in the url handling, another one in the authorization mechanism, another one
in the authentication mechanism.

How are you going to solve all these *major* issues?

>That's fine as long as you don't want to do any processing between the 
>parent and the child application. As you say, you have to 'prepare' the 
>application which is to be embedded. And it's hard to do that dynamically.

? It's impossible to do that dynamically of course. 'you have to design an application to be embeddable'.

>+        return self, segments

The fact alone that you are returning this from locateChild should ring a 
bell or two. It's plain wrong, discouraged, not recommended and will cause 
cancer (and probably even other side effects).

>The links are not correct (at least in the pastebin). I have also written a 
>preprocessor which takes care of links in the templates. I'm not sure how to 
>make the pastebin return the correct links, though.

request.rememberRootURL()

>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'!

All this instead of better designing your database and application? wow... 
Have you ever heard of KISS?
And this has _nothing_ to do with the long thread we just had of course... 
It's already possible without any of the things you just wrote.

However I tried very hard to get you to change your point of view about the 
problem and nevow but you seem to prefer your approach. It's fine though.



More information about the Twisted-web mailing list