[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
Mon May 22 16:22:21 EDT 2006
Tres Seaver wrote:
> Philipp von Weitershausen wrote:
>>> Log message for revision 68244:
>>> Fix a test that was testing wrong behaviour: primitive types
>>> werent' called if they were the result of a path expression, while
>>> all other callables were called. This tests now tests the correct
>>> behaviour (which happens to be already implemented by the Zope 3
>>> TALES engine)
>
>>> + assert ec.evaluate('x | python:int') == 0
>
> Wait a minute -- that isn't a path expression there!
Yes it is. This line could explicitly written as:
assert ec.evaluate('path: x | python:int') == 0
The python: expression is just part of the path expression.
> The '|' is not supposed to change the rules for evaluation of the
> subexpressions!
It doesn't change the rules for the evaluation of the subexpressions
themselves. But it might easily change the rules of what happens to the
result of the expression afterwards.
> If
> 'int' or the like were somehow avaialbe at module scope, or via
> 'options' or another top-level name, then they should be called *when
> they are the last item in a path expression*.
>
> The test was actually correct beofore: because tne PathExpression, 'x',
> raises, the PythonExpression, 'int', is evalutated. The result of a
> subexpression is not suppoeed to be called,
No, not the result of a subexpression, but the result of the overall
path expression. That's how it works in both Zope 2 and Zope 3. Zope 2
just special-cases primitive types.
Philipp
More information about the Zope-Dev
mailing list