Hi,

for my project Pyxer <http://code.google.com/p/pyxer/> I am trying to adopt Kid for the Google App Engine (GAE). Since it is not possible to write files on GAE I have to patch the template loading process. So I tried to solve this like it has been described in the Kid documentation with something like a template manager. But still I get errors within the generated source. I tracked it down to a small example that is attached to this mail. Could someone please give me a hand and show me how to implement this the best way for Kid?

Thanks
Dirk

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="manager.load(page)" xmlns:py="http://purl.org/kid/ns#";>
    <body>
        <p>my content</p>
    </body>
</html>"""

class KidTemplateManager:

    def load(self, value):
        import kid
        return kid.load_template(
            kid.QuickTextReader(value),
            # name=path,
            cache=False,
            ns={"manager": self, "page": master},
            encoding=None,
            )

template = KidTemplateManager().load(page)
print template.serialize()
-------------------------------------------------------------------------
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