One of the biggest problems with the current Kid implementation is that 
it compiles Kid templates into Python modules in an intermediate step. 
This makes tracking down errors in your Kid templates a very annoying 
thing since the errors reported are in the compiled Python module, and 
it is not obvious to which location in the original Kid template the 
erroneous line actually corresponds. Even worse, you usually don't have 
the Python source code of the compiled templates available, but only the 
compiled Python file (you can compile to Python source in Kid as well, 
but this is not the default for performance and other reasons).

Though it surely looked ingenious in the beginning, maybe this was a 
wrong design decision, since it turned out that it really complicates 
everything and does not even bring the desired performance advantage. 
Luckily, this whole problem has been tackled and solved by the Genshi 
project recently which is an alternative implementation that diverges in 
some aspects and will supersede Kid eventually. Therefore I don't think 
we should change the original implementation because then we could 
better put our efforts into the Genshi project.

Instead, I think it is good to keep Kid the way that it is, as a 
reference implementation and proof of concept, making it more stable, 
fixing bugs, improving details, and hopefully releasing a stable version 
1.0 some time soon.

As a step into that direction (and a small Christmas present to all Kid 
users ;-) I have just implemented (in the SVN trunk) an improved error 
reporting mechanism that is able to track down errors to their 
corresponding location in the original Kid (XML) template.

I have realized this by adding a debug mode to the codewriter in which 
it requests location information from the Expat parser and tries to 
match this with the location of an error that has occurred in the 
compiled Kid template. The debug mode and error tracking is only and 
automatically activated once an error really occurred, so it does not 
slow down the Kid templates in production when everything works fine, 
and it does not need to be explicitly activated. In Python <2.4 the new 
error reporting does not work, you'll get the old messages then. This is 
because Python <2.4 does not have the necessary Expat parser attributes.

All unit tests are still working, and I have added some more tests for 
this new error tracking.

Please let me know what you think of this new feature and whether it 
works for you, since I haven't tested it really heavily yet.

-- Christoph

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss

Reply via email to