[ZPT] CVS: Products/PageTemplates - CHANGES.txt:1.15 PythonExpr.py:1.5 TALES.py:1.19

evan@cvs.baymountain.com evan@cvs.baymountain.com
Mon, 23 Jul 2001 14:11:28 -0400


Update of /cvs-repository/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv27441

Modified Files:
	CHANGES.txt PythonExpr.py TALES.py 
Log Message:
Fix bug with expressions containing newlines.

 
====== Updated Products/PageTemplates/CHANGES.txt, 1.14 => 1.15 ======
       Bugs Fixed
 
+        - Expressions with embedded newlines were broken


====== Updated Products/PageTemplates/PythonExpr.py, 1.4 => 1.5 ======
 from TALES import CompilerError
 from string import strip, split, join, replace, lstrip
+from sys import exc_info
 
 class getSecurityManager:
     '''Null security manager'''
@@ -106,7 +107,7 @@
             self._f = d['f']
         except:
             raise CompilerError, ('Python expression error:\n'
-                                  '%s: %s') % sys.exc_info()[:2]
+                                  '%s: %s') % exc_info()[:2]
         self._get_used_names()
 
     def _get_used_names(self):


====== Updated Products/PageTemplates/TALES.py, 1.18 => 1.19 ======
 
 NAME_RE = r"[a-zA-Z][a-zA-Z0-9_]*"
-_parse_expr = re.compile(r"(%s):(.*)" % NAME_RE).match
+_parse_expr = re.compile(r"(%s):" % NAME_RE).match
 _valid_name = re.compile('%s$' % NAME_RE).match
 
 class TALESError(Exception):
@@ -195,7 +195,8 @@
     def compile(self, expression):
         m = _parse_expr(expression)
         if m:
-            type, expr = m.group(1, 2)
+            type = m.group(1)
+            expr = expression[m.end():]
         else:
             type = "standard"
             expr = expression