Dirk Holtwick wrote: > Sorry, I ran into another problem :( > > If I use files instead of variables it does not work anymore. I attached > an example. Do you have an idea? Seems as if the namespace "ns" is not > passed correctly... but thats just an idea.
Your master.html and index.html files seem a bit screwed up. Also, the pool should be a dictionary, not a list. And you don't need to read the file, load_template takes a filename as well. So try this: ------------------- 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>""" open('master.html', 'w').write(master) page = """\ <html xmlns:py="http://purl.org/kid/ns#" py:extends="load('master.html')"> <body> <p>my content</p> </body> </html>""" open('index.html', 'w').write(page) class KidTemplateManager: def __init__(self): self.pool = {} self.load('master.html') def load(self, path): template = self.pool.get(path) if not template: template = kid.load_template( path, cache=False, ns=dict(load=self.load)) self.pool[path] = template return template template = KidTemplateManager().load("index.html") print template.serialize() ------------------- -- 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