On 11/1/05, wavy davy <[EMAIL PROTECTED]> wrote:
> I would prefer to use kid to do all my HTML generation ('cos its damn
> good at it, and 'cos javascript isn't). I think I want to be able to
> call a method via an AJAX request that returns the kid-generated HTML
> (as opposed to JSON), and swap this directly into the DOM.Understandable. MochiKit.DOM is very nice, but you wouldn't want to use it for everything. > > I can think of a few ways of doing this: > > a) specifying a ajax parameter flag on the AJAX call, and using > tg_template in Root.page() to change the template to generate only be > the part I want (i.e. the table). This requires an additional template > with just the table in it, again breaking the DRY concept. You could > use py:def/py:match to alleviate some repetition, but I don't like the > idea of an extra one line file. I haven't experimented with it myself, but Kid has something new in 0.7 (we should have it in TurboGears as well, since we're using Kid from svn) called "layout templates": http://lesscode.org/projects/kid/ticket/62 This allows you to flip around the template relationship a bit. You lose the ability to view individual templates in the browser, but if that's not important to you this may be a good way to go. Kevin

