[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL - DummyEngine.py:1.32 HTMLTALParser.py:1.33 TALDefs.py:1.28 TALGenerator.py:1.55 TALInterpreter.py:1.69 TALParser.py:1.19 XMLParser.py:1.9 __init__.py:1.3 driver.py:1.28 markbench.py:1.4 ndiff.py:1.4 runtest.py:1.22 setpath.py:1.6 timer.py:1.12 HTMLParser.py:NONE markupbase.py:NONE

Jim Fulton jim@zope.com
Mon, 10 Jun 2002 19:30:15 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/TAL
In directory cvs.zope.org:/tmp/cvs-serv20468/lib/python/Zope/TAL

Modified Files:
	DummyEngine.py HTMLTALParser.py TALDefs.py TALGenerator.py 
	TALInterpreter.py TALParser.py XMLParser.py __init__.py 
	driver.py markbench.py ndiff.py runtest.py setpath.py timer.py 
Removed Files:
	HTMLParser.py markupbase.py 
Log Message:
Merged Zope-3x-branch into newly forked Zope3 CVS Tree.

=== Zope3/lib/python/Zope/TAL/DummyEngine.py 1.31 => 1.32 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """
@@ -22,9 +22,7 @@
 
 from TALDefs import NAME_RE, TALESError, ErrorInfo
 
-class Default:
-    pass
-Default = Default()
+Default = object()
 
 name_match = re.compile(r"(?s)(%s):(.*)\Z" % NAME_RE).match
 


=== Zope3/lib/python/Zope/TAL/HTMLTALParser.py 1.32 => 1.33 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/TAL/TALDefs.py 1.27 => 1.28 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """
@@ -32,7 +32,6 @@
     "use-macro",
     "define-slot",
     "fill-slot",
-    "slot",
     ]
 
 KNOWN_TAL_ATTRIBUTES = [


=== Zope3/lib/python/Zope/TAL/TALGenerator.py 1.54 => 1.55 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/TAL/TALInterpreter.py 1.68 => 1.69 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """
@@ -85,7 +85,7 @@
                  strictinsert=1, stackLimit=100):
         self.program = program
         self.macros = macros
-        self.engine = engine
+        self.engine = engine # Execution engine (aka context)
         self.Default = engine.getDefault()
         self.stream = stream or sys.stdout
         self._stream_write = self.stream.write
@@ -169,7 +169,7 @@
 
     bytecode_handlers = {}
 
-    def interpret(self, program, None=None):
+    def interpret(self, program):
         oldlevel = self.level
         self.level = oldlevel + 1
         handlers = self.dispatch
@@ -274,7 +274,7 @@
                 name = prefix + "use-macro"
                 value = macs[-1][0] # Macro name
             elif suffix == "define-slot":
-                name = prefix + "slot"
+                name = prefix + "fill-slot"
             elif suffix == "fill-slot":
                 pass
             else:
@@ -447,6 +447,16 @@
             self.insertXMLStructure(text, repldict)
     bytecode_handlers["insertStructure"] = do_insertStructure
 
+
+# XXX There is a bug in the dance between TALInterpreter and TALES.
+# TALInterpreter expects contexts to also be engines. When someone
+# inserts structure, the structure can, apparently have TAL, because
+# the TAL compiler is used. If there was TAL, it would try to use the
+# engine, which is a context, to compile expressions found. The TALES
+# context is not a compiler. Is this a YAGNI?
+
+
+
     def insertHTMLStructure(self, text, repldict):
         from HTMLTALParser import HTMLTALParser
         gen = AltTALGenerator(repldict, self.engine, 0)
@@ -521,12 +531,11 @@
                 raise METALError("macro %s has incompatible mode %s" %
                                  (`macroName`, `mode`), self.position)
         self.pushMacro(macroName, compiledSlots)
-        saved_source = self.sourceFile
-        saved_position = self.position  # Used by Boa Constructor
+        prev_source = self.sourceFile
         self.interpret(macro)
-        if self.sourceFile != saved_source:
-            self.engine.setSourceFile(saved_source)
-            self.sourceFile = saved_source
+        if self.sourceFile != prev_source:
+            self.engine.setSourceFile(prev_source)
+            self.sourceFile = prev_source
         self.popMacro()
     bytecode_handlers["useMacro"] = do_useMacro
 
@@ -542,15 +551,14 @@
             return
         macs = self.macroStack
         if macs and macs[-1] is not None:
-            saved_source = self.sourceFile
-            saved_position = self.position  # Used by Boa Constructor
             macroName, slots = self.popMacro()[:2]
             slot = slots.get(slotName)
             if slot is not None:
+                prev_source = self.sourceFile
                 self.interpret(slot)
-                if self.sourceFile != saved_source:
-                    self.engine.setSourceFile(saved_source)
-                    self.sourceFile = saved_source
+                if self.sourceFile != prev_source:
+                    self.engine.setSourceFile(prev_source)
+                    self.sourceFile = prev_source
                 self.pushMacro(macroName, slots, entering=0)
                 return
             self.pushMacro(macroName, slots)


=== Zope3/lib/python/Zope/TAL/TALParser.py 1.18 => 1.19 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/TAL/XMLParser.py 1.8 => 1.9 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/TAL/__init__.py 1.2 => 1.3 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
-""" Template Attribute Language package """
+""" Template Application Language package """


=== Zope3/lib/python/Zope/TAL/driver.py 1.27 => 1.28 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/TAL/markbench.py 1.3 => 1.4 ===
-
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
 # This software is subject to the provisions of the Zope Public License,
-# Version 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-
-
+# 
+##############################################################################
 '''Run benchmarks of TAL vs. DTML'''
 
 try:


=== Zope3/lib/python/Zope/TAL/ndiff.py 1.3 => 1.4 ===
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+# 
+##############################################################################
 
 # Module ndiff version 1.6.0
 # Released to the public domain 08-Dec-2000,


=== Zope3/lib/python/Zope/TAL/runtest.py 1.21 => 1.22 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """


=== Zope3/lib/python/Zope/TAL/setpath.py 1.5 => 1.6 ===
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+# 
 # This software is subject to the provisions of the Zope Public License,
-# Version 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-
+# 
+##############################################################################
 """
 Read a module search path from .path.
 """
@@ -21,7 +27,7 @@
     for line in f.readlines():
         line = line.strip()
         if line and line[0] != '#':
-            for dir in line.split(os.pathsep):
+            for dir in string.split(line, os.pathsep):
                 dir = os.path.expanduser(os.path.expandvars(dir))
                 if dir not in sys.path:
                     sys.path.append(dir)


=== Zope3/lib/python/Zope/TAL/timer.py 1.11 => 1.12 ===
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
 """

=== Removed File Zope3/lib/python/Zope/TAL/HTMLParser.py ===

=== Removed File Zope3/lib/python/Zope/TAL/markupbase.py ===