[Zope] Not quite right I think

Casey Duncan cduncan@kaivo.com
Thu, 05 Jul 2001 11:15:17 -0600


Peter Bengtsson wrote:
> 
> Somebody called Kemalus (can't find his email address)
> wrote this http://www.zope.org/Members/Kemalus/smart_using_namespace
> 
> He says that <dtml-var foo> is better than <dtml-var "REQUEST.form['foo']">
> "This allows your code to be more readable, hence more maintainable."
> 
> I disagree!
> Looking back at old DTML I find myself wonder sometimes, "which namestack is
> this expected to come from?"
> In <dtml-var foo> 'foo' could be a method, a template, a property or any of
> the many REQUEST dictionaries.
> So debugging <dtml-var foo>, you have to search in all of this
> possibilities, whereas with <dtml-var "REQUEST.form['foo']"> can only come
> from one place.
> 
> No offense Kemalus. I just constructivly critize.
> Readability isn't about the number of characters of text or the number of
> quotation marks.
> 
> What do the others think?
> 
> Peter
> 

REQUEST.form['foo'] is overly verbose:

REQUEST.foo will work just as well so long as you don't name any form
fields the same as built-in REQUEST attrs.

I myself find myself doing this a good bit:

<dtml-with name="REQUEST" only>
  <dtml-var name="foo">
  <dtml-var name="eggs">
  <dtml-var name="spam">
</dtml-with>

Which to me is pretty explicit.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>