[ZPT] CVS: Packages/TAL - DummyEngine.py:1.20 README.txt:1.18 TALInterpreter.py:1.36 TALParser.py:1.14 driver.py:1.23 runtest.py:1.15

guido@digicool.com guido@digicool.com
Fri, 27 Apr 2001 13:25:37 -0400 (EDT)


Update of /cvs-repository/Packages/TAL
In directory korak:/tmp/cvs-serv29367

Modified Files:
	DummyEngine.py README.txt TALInterpreter.py TALParser.py 
	driver.py runtest.py 
Log Message:
Renamed the test subdirectory to tests.  Do cvs update -d -P to get all the changes.


--- Updated File DummyEngine.py in package Packages/TAL --
--- DummyEngine.py	2001/03/29 00:00:06	1.19
+++ DummyEngine.py	2001/04/27 17:25:04	1.20
@@ -92,6 +92,8 @@
 
 from TALDefs import NAME_RE, TALError, TALESError
 
+CancelAction = []
+
 class DummyEngine:
 
     def __init__(self, macros=None):
@@ -120,10 +122,12 @@
         if self.locals is self.stack[-1]:
             # Unmerge this scope's locals from previous scope of first set
             self.locals = self.locals.copy()
-        self.locals[name] = value
+        if value is not CancelAction:
+            self.locals[name] = value
 
     def setGlobal(self, name, value):
-        self.globals[name] = value
+        if value is not CancelAction:
+            self.globals[name] = value
 
     def evaluate(self, expression):
         expression = self.uncompile(expression)
@@ -220,6 +224,9 @@
 
     def getTALESError(self):
         return TALESError
+
+    def getCancelAction(self):
+        return CancelAction
 
 class Iterator:
 

--- Updated File README.txt in package Packages/TAL --
--- README.txt	2001/04/10 03:00:12	1.17
+++ README.txt	2001/04/27 17:25:04	1.18
@@ -36,18 +36,18 @@
 
 The script driver.py takes an XML file with TAL markup as argument and
 writes the expanded version to standard output.  The filename argument
-defaults to test/test1.xml.
+defaults to tests/input/test01.xml.
 
 Regression test
 ---------------
 
-There are a number of test files in the test subdirectory, named
-test/input/test<number>.xml and test/input/test<number>.html.  The
+There are a number of test files in the 'tests' subdirectory, named
+tests/input/test<number>.xml and tests/input/test<number>.html.  The
 Python script ./runtest.py calls driver.main() for each test file, and
 should print "<file> OK" for each one.
 
-In addition, there are unit test suites in the test subdirectory;
-these can be run with test/run.py.  This should print a number of
+In addition, there are unit test suites in the 'tests' subdirectory;
+these can be run with tests/run.py.  This should print a number of
 testcase names plus progress info, ending with a line saying "OK".
 It requires that ../unittest.py exists.
 
@@ -67,7 +67,7 @@
 __init__.py		empty file that makes this directory a package
 runtest.py		Python script to run regression tests
 ndiff.py		helper for runtest.py to produce diffs
-test/			drectory with test files and output
+tests/			drectory with test files and output
 
 Author and License
 ------------------

--- Updated File TALInterpreter.py in package Packages/TAL --
--- TALInterpreter.py	2001/04/10 02:12:12	1.35
+++ TALInterpreter.py	2001/04/27 17:25:04	1.36
@@ -157,6 +157,7 @@
         self.macros = macros
         self.engine = engine
         self.TALESError = engine.getTALESError()
+        self.CancelAction = engine.getCancelAction()
         self.stream = stream or sys.stdout
         self.debug = debug
         self.wrap = wrap
@@ -268,6 +269,8 @@
                         value = self.engine.evaluateText(item[3])
                         if value is None:
                             continue
+                        if value is self.CancelAction:
+                            value = item[1]
                 elif (action == "metal" and self.currentMacro and
                       name[-13:] == ":define-macro" and self.metal):
                     name = name[:-13] + ":use-macro"
@@ -314,6 +317,9 @@
         text = self.engine.evaluateText(expr)
         if text is None:
             return
+        if text is self.CancelAction:
+            self.interpret(block)
+            return
         text = cgi.escape(text)
         self.stream_write(text)
 
@@ -324,6 +330,9 @@
         structure = self.engine.evaluateStructure(expr)
         if structure is None:
             return
+        if structure is self.CancelAction:
+            self.interpret(block)
+            return
         text = str(structure)
         if not repldict and not self.strictinsert:
             # Take a shortcut, no error checking
@@ -378,6 +387,9 @@
             self.interpret(block)
             return
         macro = self.engine.evaluateMacro(macroExpr)
+        if macro is self.CancelAction:
+            self.interpret(block)
+            return
         if not isCurrentVersion(macro):
             raise METALError("macro %s has incompatible version %s" %
                              (`macroName`, `getProgramVersion(macro)`),

--- Updated File TALParser.py in package Packages/TAL --
--- TALParser.py	2001/04/07 19:25:03	1.13
+++ TALParser.py	2001/04/27 17:25:04	1.14
@@ -184,7 +184,7 @@
 def test():
     import sys
     p = TALParser()
-    file = "test/test1.xml"
+    file = "tests/input/test01.xml"
     if sys.argv[1:]:
         file = sys.argv[1]
     p.parseFile(file)

--- Updated File driver.py in package Packages/TAL --
--- driver.py	2001/04/10 02:12:46	1.22
+++ driver.py	2001/04/27 17:25:04	1.23
@@ -103,7 +103,7 @@
 import TALDefs
 from DummyEngine import DummyEngine
 
-FILE = "test/input/test01.xml"
+FILE = "tests/input/test01.xml"
 
 def main():
     versionTest = 1

--- Updated File runtest.py in package Packages/TAL --
--- runtest.py	2001/03/21 22:37:50	1.14
+++ runtest.py	2001/04/27 17:25:04	1.15
@@ -125,7 +125,7 @@
         opts.append(args[0])
         del args[0]
     if not args:
-        prefix = os.path.join("test", "input", "test*.")
+        prefix = os.path.join("tests", "input", "test*.")
         xmlargs = glob.glob(prefix + "xml")
         xmlargs.sort()
         htmlargs = glob.glob(prefix + "html")