[Zope] Testing multiple values for existance - still

Oliver Sturm sturm@oliver-sturm.de
Wed, 26 Sep 2001 12:15:54 +0200


On 25.09.2001 13:42:49 -0400 Paul Winkler <slinkp23@yahoo.com> wrote:

>> 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? 
> 
> Exactly. Inside a dtml tag, anything in quotes is treated as python code.
> 
>> If yes, I'd consider that a large
>> drawback and inconsistency... and does Python syntax for the test have to
>> be so complicated?
> 
> It's not "complicated" in normal python programming, which is usually
> easy, flexible, and powerful. But when you're limited to what you can
> fit between quotes in a dtml tag, you can't really take advantage of
> python effectively. It was never meant to be a language for
> one-liners.

Would be nice if there was a built-in function that does the very same thing
that Zope does implicitly in <dtml-if foo>, only explicitly in a python
expression. So I could go <dtml-if "checkforexistenceandvalue ('foo') and
checkforexistenceandvalue ('bar')">. The way it is, that's hidden magic to
me. I hate it if I get the feeling that the system uses functionality that's
not available for me to use, too. Kind of like programming VBA :-)

> But of course, we have python scripts and external methods, which are
> much better for jobs like this. 

[ cut ] 

> Much nicer, eh?

Yes, thanks for that! Seems like I'll have to use those scripts more...
(I've even been writing some external scripts in Python, only I was a little
reluctant to use them all over the place for things as simple as some
existence checking :-)

Oliver

-- 
Oliver Sturm / <sturm@oliver-sturm.de>