On February 05, 2006 12:05 pm, Dan Jacob wrote: > I've noticed that the latest SVN of Kid has new tags for handling > layout templates, py:layout and py:slot. Has anyone used these or > written any documentation about them ? How do they work with py:match > and py:def for example ?
After investigating them to replace our existing py:match master template
(with py:def slots), we determined that the refactoring was too much effort
for any possible gain. Our existing template (posted earlier) uses the
following structure:
<html>
<head py:match="{...}head">...</head>
<div py:def="leftSlot">
Default slot content...
</div>
<body py:match="{...}body">
<div id="header">...</div>
<div id="content" py:content="item[:]" />
<div id="left-slot" py:content="leftSlot()" />
</body>
</html>
In the page template, we re-define the leftSlot to override the default, and
you have an effective, defaulting slot system. Don't want a default? Don't
define one in the master template.
py:slot is purely redundant semantic magic serving an identical purpose to
py:def. Unless I've misunderstood ticket #63 and the execution is backwards.
I.e. page template contains default and master template overrides), which is
even less useful, at least, for me. :^)
py:layout seems to put the onus on the page template, which we felt was
inherently wrong. The page templates should be allowed to be as simple as
possible, in the case of my master template, the simplest page is:
<html xml:ns="..." py:ns="..." py:extends="'master.kid'">
<head />
<body>
Stuff goes here.
</body>
</html>
That's it, and it works, too. (Not to mention saving the repetition of code
in a multitude of py:match statements.)
- Matthew
pgpe4hEMnSPqD.pgp
Description: PGP signature

