Justin Johnson wrote:


Hi, I've been rummaging around in the documentation but this has eluded me.

I've got a url mapping to an ajax call. The intention is to return a lump of html that's injected into the page client side.

So ideally, my ajax call should return a string which is the product of a kid template with some variable insertions.

Question is, how do I manually call kid to generate a string given a kid template and a variable dictionary?


There may be another way, but in TurboStan to render Kid fragments, I just do something like this:

import kid
s = "some kid template stuff"
template = kid.Template(source = s) return template.serialize()

I use **kwargs cause I just transparently pass user-supplied info, but you'd probably use source = "<template>".

Regards,
Cliff

Reply via email to