On 26.09.2001 19:54:37 +0200 Dieter Maurer <dieter@handshake.de> wrote:
- How exactly is the expression "foo" defined? The expression "foo" is defined as "foo"....
I was thinking of "foo" as a Zope expression like in <dtml-if foo>. Like I > wrote in the other thread, there must be some internal method that Zope uses > to do that existence and value check. Why can't I use that from the Python > expression? (Yes, I know that now, I can do the same thing, only I thought > it was a little more intuitive.)
Again, you stopped reading too early!
No, I didn't.
The section following the one quoted above explained how "foo" is interpreted in a boolean context (such as the "dtml-if").
The section you are referring to details how "foo" is interpreted in a boolean context in the Python language. I was asking how the expression "foo" is interpreted in <dtml-if foo> (not <dtml-if "foo">), that is, in a Zope context. Obviously, there's a difference, otherwise <dtml-if foo> and <dtml-if "foo"> would be the same and <dtml-if "foo and bar"> would be the same as <dtml-if foo><dtml-if bar>, which is not the case.
It is the same way as in Python with the exception that "dtml-if" considers a missing name as false while Python considers a missing name as an exception...
And the question was how do I write a Python expression that works on the foo thing just the same way Zope (the dtml-if) does. You answered that already early on, thanks for that, and I was only commenting that I was expecting to find that functionality, which is very integral to Zope, readily available for my use. Something like the script check_for_any that Paul Winkler kindly provided in the other thread would belong in some global library for everyone to use instead of reinvent the wheel all the time. I'm absolutely sure there's such a function somewhere in Zope source, I was only wondering why I have to write complex expressions instead of just using it.
Please read my replies carefully!
It takes time to prepare them and it is unfriendly to ignore essential parts of them and therefore follow-up with an additional question.
I may use the kill-file facility of my newsreader to protect myself....
Dear lord. Oliver -- Oliver Sturm / <sturm@oliver-sturm.de>