[Zope] Using tal and no dmtl.
John Kipling Lewis
Fri, 30 May 2003 11:27:51 -0400 (EDT)
On Fri, 30 May 2003, Paul Winkler wrote:
> On Fri, May 30, 2003 at 09:34:50AM -0400, John Kipling Lewis wrote:
> > On Fri, 30 May 2003, Dmitry Dembinsky wrote:
> > > We use tal:define for this purpose:
> > >
> > > <body tal:define="dummy python:foo(); <other assignments>" ...
> > >
> > > Usually this way we run some page setup code which we put inside <body>
> > > or even top-level <html> tag.
> > We have done this as well. It just seemed an obvious hole in the tal
> > system. There should be a way to execute arbitrary code in tal.
> > Something like:
> > <body tal:run="python:foo()">
> tal:define works perfectly well for this.
> I don't think we need a new tal statement just for the special case of
> not caring about the return value.
If define allow you to not "define" a variable then I would agree, but
it's confusing for people looking at the code to define a variable and
then never use it. For example:
<body tal:define="foo python:foo()">
If foo() doesn't return anything, you've just defined a variable foo that
doesn't do anything which will confuse anyone who is new to the code. I
shouldn't have to define a variable just to run foo().