[ZPT] METAL expansion only when editing

Peter Bengtsson mail@peterbe.com
Mon, 10 Sep 2001 16:26:25 +0200


Well, I guess you're right.

You said that macro expansion is as cheap as tal:replace "as far as I know".
Can somebody (hint Evan) confirm this who knows for sure?

Cheers, Peter

----- Original Message -----
From: "John Morton" <jwm@plain.co.nz>
To: "Peter Bengtsson" <mail@peterbe.com>
Cc: <zpt@zope.org>
Sent: Monday, September 10, 2001 3:47 PM
Subject: Re: [ZPT] METAL expansion only when editing


On Monday 10 September 2001 19:23, Peter Bengtsson wrote:
>  Ok then.
>
>  What is the difference between using macros or tal:replace when you're
>  always having the little "Expand while editing" thing off?

If you're using tal:replace to drop a fragment of markup into another
document, it can't be a full html document in it's own right. This means
that
it won't behave itself when edited in an html editor and can't be feed to
tools like 'tidy' to verify that it's fully formed html or xhtml and so on.

If you use metal instead, you can include all the usual document scaffolding
to keep those tools happy, and mark out the bit that you want to use as a
macro.

One of the nice things about METAL is that it makes it fairly easy to build
a
tool to discover the relationships between a set of page tempates - what is
use where, what fills slots in some template and so on - as you can be
pretty
sure that anything refered to in a METAL statement is going to be some page
template. If you use tal:replace, you can't be sure that the thing refered
to
by the statement isn't an attribute of some object, or what the object is
without practically rendering each and every template.

>  What is most precious to me is processing speed in this case. We must
> avoid all luxiurios editing options to gain time.

Macro expansion is cheap as far as I know; no more expensive than
tal:replace
and conveniently separate from all other tal command. Certainly, Zope
routinely does other more expensive operations every access (aquisition,
security checks and so on).

John

_______________________________________________
ZPT mailing list
ZPT@zope.org
http://lists.zope.org/mailman/listinfo/zpt