[ZPT] python: path(request/foo) or 0
Evan Simpson
evan@zope.com
Sun, 03 Feb 2002 11:02:13 -0500
Tim Head wrote:
> i've got a question. in one of the examples(the file thingie) the start
> varible has the value that is submited with the request or if left blank
> defaults to 0. i tried to do they same in one of my pages with the
> result that i end up with an error if the variable isn't submited with
> the request.
> It seems the OR doesn't work.
I haven't been careful enough to keep the examples and docs in line with
the current implementation :-(
For a while, "path('whatever')" in a Python expression would evaluate to
an un-raised exception if the path failed to resolve. This exception
was false-valued, so the OR trick worked. This was a Wrong Thing, and
caused other problems. The proper way to do this now is:
python:path('whatever | nothing') or 0
Cheers,
Evan @ Zope