michelts wrote:
> I'm working on an idea: I wish to be able to setup the kid template
> without edit it.

You can already have a template be based on a master servlet and do the 
initialion there (e.g., see SimpleForm.kid, based on KidExamplePage).

However, I think I understand what you want to say: There is no way to 
*automatically* bind a template to an individual base servlet or other 
kind of setup code. And I think you're right, that's a drawback.

Maybe the problem is that KidKit was made with the idea of replacing 
PSP, where mixing code and design was rather considered a conventient 
feature than a problem. However, to really meet the spirit of Kid, it 
actually would have required using a different paradigm.

 > With the construction above I can give database information to the
 > designer without edit his template. The KidPage doesn't exists, so
 > I thinking on create something like this, this servlet's goal is
 > to load the template on the fly, if my servlet is named MyPage it can
 > search for MyPage.kid...
 > ...
 > The KidPage will have a function called setup() called before the
 > template is rendered and a function called teardown() called after the
 > rendering. I think reather than just printing the template to the
 > servlet I must return it on a function and then write the result,

Yes, something like that could be more appropriate for Kid. But don't 
you want KidPage to be a subclass of the standard WebKit Page? Then, I 
don't see a need for setup() and teardown() methods since we already 
have awake() and sleep() and you can also use the __init__ method.

KidPage could provide additional methods similar to Kid, such as 
load_template(), serialize, generate(), write(), with the difference 
that there should be some caching behind and parameters should 
automagically be set appropriately. For instance, write() would 
automatically call load_template, which in turn would automatically load 
the template MyPage.kid, when MyPage is the current servlet class, and 
it would automatically write output to the HTTP response. But you would 
be also able to use serialize() and filter the output before writing.

Another idea: Maybe, instead of providing a KidPage class, we should 
better provide a KidServlet mixin that adds this Kid Tempalte 
functionality to ordinary Webware servlets?

Also, it should still be possible to have Kid templates without any 
accompanying Webware class. In this case, the class would be 
automatically asumed to be WebKit.Page, with the respond() replace so 
that it writes the serialized Kid template.

-- Christoph


_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to