[ZPT] path() changed in tales?

Evan Simpson evan@zope.com
Thu, 14 Mar 2002 10:42:50 -0500


alex wrote:
> tal:define="offset python:path('request/offset') or 0"

The new way to do this in general would be:

tal:define="offset python:path('a/b | nothing') or whatever"

This changed partially as a side effect of a bug fix, and partially 
because the old behaviour was wrong and unnecessary.  It used to be the 
case that failed path expressions returned the exception that caused 
them to fail, wrapped in *another* expression that evaluated false, thus 
allowing the idiom you used.  This caused a number of problems, since 
the exception wrapping was fragile and the false-valued exception 
confused the Zope error handler.

Cheers,

Evan @ Zope