[ZPT] CVS: Packages/TAL - CHANGES.txt:1.5 TALDefs.py:1.22

evan@serenade.digicool.com evan@serenade.digicool.com
Mon, 2 Jul 2001 12:48:56 -0400


Update of /cvs-repository/Packages/TAL
In directory serenade:/home/evan/Zope/pt/lib/python/TAL

Modified Files:
	CHANGES.txt TALDefs.py 
Log Message:
Made tal:attribute parser more strict, and replaces "print" statements with raised exceptions.



--- Updated File CHANGES.txt in package Packages/TAL --
--- CHANGES.txt	2001/06/21 14:50:27	1.4
+++ CHANGES.txt	2001/07/02 16:48:55	1.5
@@ -12,3 +12,6 @@
 
         - tal:atributes was creating stray attributes in METAL
           expansion, and there was no unit test for this behavior.
+
+        - tal:attributes parsing was not catching badly malformed
+          values, and used "print" instead of raising exceptions.

--- Updated File TALDefs.py in package Packages/TAL --
--- TALDefs.py	2001/06/08 22:59:33	1.21
+++ TALDefs.py	2001/07/02 16:48:55	1.22
@@ -153,7 +153,7 @@
         self.info = info
 
 import re
-_attr_re = re.compile(r"\s*([^\s]+)\s*(.*)\Z", re.S)
+_attr_re = re.compile(r"\s*([^\s]+)\s+([^\s].*)\Z", re.S)
 _subst_re = re.compile(r"\s*(?:(text|structure)\s+)?(.*)\Z", re.S)
 del re
 
@@ -162,12 +162,10 @@
     for part in splitParts(arg):
         m = _attr_re.match(part)
         if not m:
-            print "Bad syntax in attributes:", `part`
-            continue
+            raise TALError("Bad syntax in attributes:" + `part`)
         name, expr = m.group(1, 2)
         if dict.has_key(name):
-            print "Duplicate attribute name in attributes:", `part`
-            continue
+            raise TALError("Duplicate attribute name in attributes:" + `part`)
         dict[name] = expr
     return dict