[Zope] mixing python and DTML is hellish!
Chris Withers
chrisw@nipltd.com
Fri, 01 Mar 2002 12:39:43 +0000
kosh@aesaeion.com wrote:
>
> solution and so far I like it a lot more then ZPT. ZPT seems to have the
> idea that there should be a 1 document to 1 page mapping which I don't
> like.
Where on earth did you get that idea?
> I prefer having lots of little objects around that get assembled
> together to build a page. Especially when working with smarter objects.
I think you may have missed METAL, or at least not understood it...
> Overall DTML is easier to use with this kind of a model by a good deal.
Not true, by a good deal.
<p tal:replace="/some/other/component">Bit bit goes here</p>
...seems a lot nicer (and more predictable) to me than:
<p><dtml-var "PARENTS[-1].some.other.component(_.None,_)"></p>
> I
> doubt there is a simpler way to do <dtml-var header><dtml-var
> someobject><dtml-var footer> with all of those being python products,
> python scripts etc that know how to behave when called using a little
> python magic.
Two points:
1.
<tal:x tal:replace="here/header"><tal:x tal:replace="here/someobject"><tal:x
tal:replace="here/footer">
..if you really must. Although the concept of half your layout being in a header
and the other half in a footer is broken by design.
the correct way to do this is:
<html metal:use-macro="/some_template/macros/main">
<body metal:fill-slot="here/someobject">
</html>
...which is much more explicit, graceful and nice.
2.
"a little bit of python magic" is what causes you to get bit in the ass 6 months
down the line when you coem to make a minro tweak to the code and break
everything. Explciit is good!
> Overall it seems ZPT seems designed for html people that used wysiwyg
> editors to write pages.
So EMACS is a wysiwig editor now? Glad to hear it ;-)
> Overall I don't, nor does anyone I work with do
> that. The pages written that way just are not as clean as what you can get
> from someone that knows the spec and how to use it to their best
> advantage.
Actually, I use Dreamweaver to rapid-prototype pages (and it produces pretty
damn good HTML) and then do minro tweaks by hadn when I'm adding in the TAL. I
really like the fact that I can look at the source of the template in a browser
and see what it's going to look like without actually needing to feed loads of
dynamic content into it.
Come and have a go if you think you're hard enough ;-)
Chris