[ZPT] Possible changes to path-related

Evan Simpson evan@digicool.com
Tue, 24 Apr 2001 12:33:41 -0400


I'm almost ready to release ZPT 1.2, and I'm trying to nail down the
implementation of:
http://dev.zope.org/Wikis/DevSite/Projects/ZPT/ActOnlyIfPathExists

In the process, I decided that overloading 'exists' was not the best
solution.  Instead, I suggest adding an 'if' modifier that could operate
alone or in combination with 'exists'.  It would cancel the TAL action using
a path expression if the value is false.  When combined with 'exists', it
would do so if the path is undefined, but return the rendered value if the
path is defined.

Combining path expression types like this would be messy, and I realized
that it doesn't need to be implemented that way.  We can replace these
multiple expression types with simple path expression prefixes, as described
at:
http://dev.zope.org/Wikis/DevSite/Projects/ZPT/PathExpressionVariants

With these two proposals, we could modify an expression such as
'request/foo' four ways (plus any of these with nocall added):

1. request/foo
    Return the value of 'request/foo' if it is defined, otherwise raise an
exception.
2. if request/foo
    Return the value of 'request/foo' if it is true, raise an exception if
it is undefined, otherwise cancel the action.
3. if exists request/foo
    Return the value of 'request/foo' if it is defined, otherwise cancel the
action.
4. exists request/foo
    Return true (1) if the value of 'request/foo' is defined, otherwise
return false (0).

Please comment immediately, if you can.  I'd like to release 1.2 tomorrow,
hopefully with these features.

Cheers,

Evan @ digicool