Dirk Holtwick wrote:
> Do you have an idea why the example fails and how I could solve this
> problem? I have the impression that Kid is focused more on files than
> on strings? Help is very appreciated.

I tested a little bit and I think the reason is that load_template is 
not reentrant or something. It works if you do it like that:

-------------

master = """\
<html xmlns:py="http://purl.org/kid/ns#";>
     <body py:match="item.tag == 'body'">
         <p>my header</p>
         <div py:replace="item[:]" />
         <p>my footer</p>
     </body>
</html>"""

page = """\
<html py:extends="master" xmlns:py="http://purl.org/kid/ns#";>
     <body>
         <p>my content</p>
     </body>
</html>"""

class KidTemplateManager:

     def __init__(self, master):
         self.master = None
         self.master = self.load(master)

     def load(self, source):
         import kid
         return kid.load_template(source, cache=False,
             ns=dict(master=self.master))

template = KidTemplateManager(master).load(page)

print template.serialize()

-------------

I'd like to make a ticket of this to investigate further, but the trac 
is still broken and I still can't log in (@David: hint, hint!).

-- Christoph


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
kid-template-discuss mailing list
kid-template-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kid-template-discuss

Reply via email to