[ZPT] CVS: Releases/Zope/lib/python/Products/PageTemplates - Expressions.py:1.36.6.9

Evan Simpson evan@zope.com
Thu, 26 Sep 2002 17:35:18 -0400


Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv8005/lib/python/Products/PageTemplates

Modified Files:
      Tag: Zope-2_6-branch
	Expressions.py 
Log Message:
Merge fix for Collector #538 from trunk.


=== Releases/Zope/lib/python/Products/PageTemplates/Expressions.py 1.36.6.8 => 1.36.6.9 ===
--- Releases/Zope/lib/python/Products/PageTemplates/Expressions.py:1.36.6.8	Wed Sep 25 19:20:09 2002
+++ Releases/Zope/lib/python/Products/PageTemplates/Expressions.py	Thu Sep 26 17:35: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