[Zope] mixing python and DTML is hellish!

kosh@aesaeion.com kosh@aesaeion.com
Sat, 2 Mar 2002 15:21:49 -0700 (MST)


On Sat, 2 Mar 2002, Peter Bengtsson wrote:

>
> >
> > > Why do you think ZPT is longer laster or more scalable?
> >
> >It's gonna be supported longer, it was better designed for the task, etc.
> >I could go on
> >but you won't believe me anyway and I'm close enough to RSI-land anyway...
>
> That was not what I meant.
> If a second developer three months later comes around to:
> <dtml-if something><dtml-var something></dtml-if>
> He's not gonna understand it.

Well you did violate one of the rules of refactoring there. Look at rename
method page 273 of refactoring. In my case the code would be closer to.
<dtml-if customerContactForm><dtml-var customerContactForm></dtml-if>

In this case you know what it is trying to do based on its name. It is a
poor carpenter who blames his hammer. ;)

>
> But:
> <span tal:condition="python:request.has_key('something')"
> tal:content="request/something" ></span>
> Is more easy to understand.
>
> That was just one example. There are other ways of looking at it.
>

I don't find that easier to understand but I can see where things would
need to be fixed if a variable name was changed. Overall I would probably
put that kind of thing in a python script and just call it.