[Zope-dev] Re: SVN:
Zope/branches/ajung-zpt-end-game/lib/python/Products/PageTemplates/tests/testExpressions.py
Fix a test that was testing wrong behaviour: primitive types
Philipp von Weitershausen
philipp at weitershausen.de
Thu May 25 12:58:18 EDT 2006
Tres Seaver wrote:
> If a subexpression returns a callable, you're telling me that you think
> the "top-level" expression is supposed to call it? That's nuts! The
> spec[1] says:
>
>>> When a TALES path expression is evaluated, it attempts to traverse
>>> each path, from left to right, until it succeeds or runs out of
>>> paths. To traverse a path, it first fetches the object stored in the
>>> variable. For each path segment, it traverses from the current object
>>> to the subobject named by the path segment.
>>>
>>> Once a path has been successfully traversed, the resulting object is
>>> the value of the expression. If it is a callable object, such as a
>>> method or class, it is called. The semantics of traversal (and what it
>>> means to be callable) are implementation-dependent.
>>>
>>> If a traversal step fails, evaluation immediately proceeds to the
>>> next path. If there are no further paths, an error results.
>
> Calling the callable happens *before* attempting alternate expressions,
> not after. That is partly because the *call* might be what triggers
> the alternation.
>
> [1]
> http://www.zope.org/Wikis/DevSite/Projects/ZPT/TALES%20Specification%201.3
You're absolutely right. I filed a collector issue for Zope 3:
http://www.zope.org/Collectors/Zope3-dev/638
This will be fixed soon in Zope 3.
Philipp
More information about the Zope-Dev
mailing list