[ZPT] TAL Exists: type

Evan Simpson evan@digicool.com
Wed, 21 Mar 2001 11:22:24 -0500


From: "Todd Coram" <todd@digicool.com>
> If exists: checks for the existence of objects (derived from paths), how
do
> we distinguish "hard" traversal errors from "soft" ones? What does it mean
> to say "testing for whether and object exists or not" when traversal is
> dynamic? What if the act of traversal causes behavior (hit count
increment,
> random redirection, etc)?

Traversal side-effects shouldn't exist, since they are way too easy to
trigger (ZMI Find).  Intermediate elements never get called, they only get
traversed, and traversal errors are the hardest kind to miss, since you
can't manage an object that has broken traversal.

> <div
tal:condition="exists:here/yourCountry/yourState/yourCity/zopeContact">
>
> Okay, so this could return true if your "home" city has a zope contact
> person, otherwise false if there is no zope contact in that city.  But,
what
> if there is a traversal error (i.e. calling one of the elements results in
a
> "system" error)? Maybe "yourState" is broken.  What is the correct
behavior?
> Does exists: catch exceptions and silently return false?

It isn't able to operate any other way.  "exists:" returns true iff the path
can be successfully resolved, with no exceptions.

Cheers,

Evan @ digicool