[ZPT] REQUEST argument

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Mon, 14 May 2001 09:50:45 +1000


Guido van Rossum wrote:
> Apparently (I haven't written much DTML either ;-) in DTML a common
> idiom is:
> 
>   <dtml-if foo>
>     <dtml-var foo>
>   </dtml-if>
> 
> which substitutes foo only if it exists and is non-empty, and Jim
> claims that this is useful.

I found that the dual roles of that particular statement caused problems.
We actually used to have a lot of <dtml-if "_.hasattr(this(), 'foo')"> (oh
for a <dtml-exists> ;)  That way the 'foo' wasn't tested for truth
(sometimes 'foo' is a method and we really don't want it called
unnecessarily - especially if it needs arguments to be called correctly).

[I wrote a long paragraph about the differences between the DTML coding and
ZPT M-V approaches, but it was a little long and rambling and quickly
started losing relevance to this discussion. What it came down to is that
you should watch how much you're using <div> to control structure rather
than display information. If the former is too great, then switch to DTML.
Anything else is going to confuse the hell out of your Dreamweaver-using
designers... ]


    Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)