On 25.09.2001 10:24:48 -0400 Phil Harris <phil.harris@zope.co.uk> wrote:
You are missing the distinction between:
<dtml-if foo>
and
<dtml-if "foo and bar">
You're also missing some of the maddening Zope 'Magic'.
The first statement tests first for existence, and only then for value. The second assumes existence and only tests for value.
I got that at last :-). But WHY? I reckon it may be as simple as that the "'s render the whole thing a Python expression instead of something that can be handled directly by Zope. Is that so? If yes, I'd consider that a large drawback and inconsistency... and does Python syntax for the test have to be so complicated?
In your case I think you were testing for the esitence of a method, not of a variable, am I right? If foo doesn't exist then the first test returns false because foo is not in the currrent namespace, the second though drops into Python rules and has none of the Zope 'magic' applied.
That's right (I think). Although I have never actually found many differences between methods and variables when it comes to their use in expressions (up to now, that is). I was considering it one of the strengths of Zope to work with objects of different types without apparent distinctions.
I hope this goes someway to explain what you asked, of course if you'd said explicitly that you were testing for the existence of methods in the current folder, then this could be made a bit simpler.
I didn't assume people would think I was doing so very complicated things. I usually structure Zope sites in a way that allows me to work with objects in the current context (folder?) 99% of the time, praise acquisition. Now, are there even simpler ways to test for alternate existence of more than one method in the current folder? Thanks for your help! Oliver -- Oliver Sturm / <sturm@oliver-sturm.de>