[Zope] Re: CASE in point -- [Zope] Simple dtml-unless problem

Dieter Maurer dieter@handshake.de
Thu, 14 Sep 2000 22:29:41 +0200 (CEST)

 > Thanks Albert and Oleg. If I'm honest, while I have become somewhat
 > familiar with what Albert describes as zope's 'multiple personality
 > disorder', I can't say I truly understand it. I still don't think I've
 > got my head around the _['whatever'] syntax.
You like that you can use

	<dtml-var name>

both for properties, external methods and DTML objects?

If you do, then you probably like that "_['name']" does the same.
"_[...]" evaluates '...' (which should yield a string),
looks that up in the namespace (giving an object),
determines what type it is (external method, DTML object,
something callable, something else) and does what
usually is right for such an object. This means, it
either calls the method/object with appropriate parameters
or returns the object itself (if not callable).

If you do not like this, you can use "_.getitem(...)".
This returns the object itself, without magical type
specific handling.

I think, the "multiple personality disorder" does not refer
to this "_[...]" intelligence but to the fact, that
"id" usually is a (parameterless) method but sometimes
is an attribute. The "_[...]" and "<dtml-var name>" magic usually
hides this disorder, but without the magic, you may get hit by
this design flaw.