[ZPT] CVS: Releases/Zope/lib/python/Products/PageTemplates - Expressions.py:1.43
Evan Simpson
evan@zope.com
Thu, 26 Sep 2002 17:33:18 -0400
Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv7693/lib/python/Products/PageTemplates
Modified Files:
Expressions.py
Log Message:
Fix Collector #538. Path expressions with a non-path final alternate no
longer try to call a value returned by that alternate.
=== Releases/Zope/lib/python/Products/PageTemplates/Expressions.py 1.42 => 1.43 ===
--- Releases/Zope/lib/python/Products/PageTemplates/Expressions.py:1.42 Wed Sep 25 18:57:55 2002
+++ Releases/Zope/lib/python/Products/PageTemplates/Expressions.py Thu Sep 26 17:33:17 2002
@@ -154,6 +154,7 @@
def __init__(self, name, expr, engine):
self._s = expr
self._name = name
+ self._hybrid = 0
paths = expr.split('|')
self._subexprs = []
add = self._subexprs.append
@@ -163,6 +164,7 @@
# This part is the start of another expression type,
# so glue it back together and compile it.
add(engine.compile(('|'.join(paths[i:]).lstrip())))
+ self._hybrid = 1
break
add(SubPathExpr(path)._eval)
@@ -187,8 +189,11 @@
else:
break
else:
- # On the last subexpression allow exceptions through.
+ # On the last subexpression allow exceptions through, and
+ # don't autocall if the expression was not a subpath.
ob = self._subexprs[-1](econtext)
+ if self._hybrid:
+ return ob
if self._name == 'nocall' or isinstance(ob, StringType):
return ob