[ZPT] METAL expansion only when editing

Francis Potter francis@meadowbase.com
Mon, 10 Sep 2001 08:54:00 -0700


Another big difference between tal:replace and metal:fill-slot is that
metal passes variable definitions down (from tal:define and tal:repeat)
to the code being inserted (because the macros are all expanded before
the tal is processed).

--- Francis Potter
--- desk +1 (415) 826 3646
--- cell +1 (415) 310 5162
--- AIM heliumfrancis

> -----Original Message-----
> From: zpt-admin@zope.org [mailto:zpt-admin@zope.org] On=20
> Behalf Of John Morton
> Sent: Monday, September 10, 2001 6:48 AM
> To: Peter Bengtsson
> Cc: zpt@zope.org
> Subject: Re: [ZPT] METAL expansion only when editing
>=20
>=20
> On Monday 10 September 2001 19:23, Peter Bengtsson wrote:
> >  Ok then.
> >
> >  What is the difference between using macros or tal:replace=20
> when you're
> >  always having the little "Expand while editing" thing off?
>=20
> If you're using tal:replace to drop a fragment of markup into another=20
> document, it can't be a full html document in it's own right.=20
> This means that=20
> it won't behave itself when edited in an html editor and=20
> can't be feed to=20
> tools like 'tidy' to verify that it's fully formed html or=20
> xhtml and so on.=20
>=20
> If you use metal instead, you can include all the usual=20
> document scaffolding=20
> to keep those tools happy, and mark out the bit that you want=20
> to use as a=20
> macro.=20
>=20
> One of the nice things about METAL is that it makes it fairly=20
> easy to build a=20
> tool to discover the relationships between a set of page=20
> tempates - what is=20
> use where, what fills slots in some template and so on - as=20
> you can be pretty=20
> sure that anything refered to in a METAL statement is going=20
> to be some page=20
> template. If you use tal:replace, you can't be sure that the=20
> thing refered to=20
> by the statement isn't an attribute of some object, or what=20
> the object is=20
> without practically rendering each and every template.=20
>=20
> >  What is most precious to me is processing speed in this=20
> case. We must
> > avoid all luxiurios editing options to gain time.
>=20
> Macro expansion is cheap as far as I know; no more expensive=20
> than tal:replace=20
> and conveniently separate from all other tal command. Certainly, Zope=20
> routinely does other more expensive operations every access=20
> (aquisition,=20
> security checks and so on).
>=20
> John
>=20
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt
>=20